using CZFW.Framework.Interface; using CZFW.Framework.Model; using CZFW.Framework.Model.Entity; using CZKJ.GBRS2.WebMVC.Models; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace CZKJ.GBRS2.WebMVC.ViewComponents { public class FooterViewComponent : ViewComponent { public IViewComponentResult Invoke() { var item = GetItems(); return View(item); } private FooterModel GetItems() { ISysConfig sys = CZHttpContext.ServiceProvider.GetService(typeof(ISysConfig)) as ISysConfig; INavigation na = CZHttpContext.ServiceProvider.GetService(typeof(INavigation)) as INavigation; ILink link = CZHttpContext.ServiceProvider.GetService(typeof(ILink)) as ILink; var result = sys.GetSysConfig("Phone", "ZipCode", "Address", "WeChatCode", "MicroBlog", "Record"); var model = new FooterModel(); model.Phone = result.FirstOrDefault(x => x.Key == "Phone").Value; model.ZipCode = result.FirstOrDefault(x => x.Key == "ZipCode").Value; model.Address = result.FirstOrDefault(x => x.Key == "Address").Value; model.WeChatCode = result.FirstOrDefault(x => x.Key == "WeChatCode").Value; model.MicroBlog = result.FirstOrDefault(x => x.Key == "MicroBlog").Value; model.NavigationModel = na.GetNavigationTreeByMark("0$15235665423212817$"); model.NavigationHModel = na.GetNavigationTreeByMark("0$15235668675090910$"); model.Record = result.FirstOrDefault(x => x.Key == "Record").Value; model.LinkList = link.GetEntities(); return model; } } }