public PartialViewResult OtherHeader() { ViewBag.OtherNav = navApp.GetList(a => a.F_IsHeader == true); var ParentList = navApp.GetList(a => a.F_ParentId == "0" && a.F_EnabledMark == true).Select(a => a.F_Id); var PartentNav = navApp.GetList( a => ParentList.Contains(a.F_ParentId) && a.F_IsRecommend == true); ViewBag.PartentNav = PartentNav; return(PartialView()); }
public ActionResult GetNavTreeJson() { var data = navApp.GetList(); var treeList = new List <TreeViewModel>(); foreach (NavigationEntity item in data) { TreeViewModel tree = new TreeViewModel(); bool hasChildren = data.Count(t => t.F_ParentId == item.F_Id) == 0 ? false : true; tree.id = item.F_Id; tree.text = item.F_Name; tree.value = item.F_EnCode; tree.parentId = item.F_ParentId; tree.isexpand = true; tree.complete = true; tree.hasChildren = hasChildren; treeList.Add(tree); } return(Content(treeList.TreeViewJson())); }
public ActionResult Index() { //最新更新 List <ArticleEntity> NewestArticle = articleApp.GetList(a => a.F_EnabledMark == true && a.F_CreatorTime <= DateTime.Now); foreach (var item in NewestArticle) { item.NavEntity = navApp.GetForm(item.F_NavID); item.F_Link = "/" + item.NavEntity.F_EnCode + "/" + item.F_EnCode; } ViewBag.NewestArticle = NewestArticle.ToJson(); //热门排行 ViewBag.HotArticle = articleApp.GetHotList(); var gushiEntity = navApp.GetEntityByEnCode("gushi", a => a.F_EnabledMark == true); var ParentGushi = navApp.GetList(a => a.F_ParentId == gushiEntity.F_Id && a.F_IsRecommend == true); foreach (var item in ParentGushi) { List <NavigationEntity> ChildNavigationList = navApp.GetChildList(item.F_Id, false); List <NavigationEntity> ReChildNavigationList = ChildNavigationList.FindAll(a => a.F_IsRecommend == true); string navIds = ChildNavigationList.Select(a => a.F_Id).ToJson(",").Replace("\"", "'").TrimStart('[').TrimEnd(']'); List <ArticleEntity> ChildArticleList = articleApp.GetList(navIds, "", " F_EnabledMark=1 ", "F_CreatorTime DESC,F_SortCode ASC ").Take(12).ToList(); foreach (var itemArticle in ChildArticleList) { itemArticle.NavEntity = navApp.GetForm(itemArticle.F_NavID); } item.ChildArticleList = ChildArticleList; item.ChildNavigationList = ReChildNavigationList; //推荐专题 item.RecommendSpecial = specialApp.GetSpecialList(item.F_Id, true); } ViewBag.RecommendGushi = ParentGushi; return(View()); }