예제 #1
0
        public ActionResult index(string id, int pageIndex = 1)
        {
            //分类实体
            NavigationEntity navigationEntity = navigationApp.GetForm(a => a.F_EnCode.Equals(id, StringComparison.OrdinalIgnoreCase));

            if (navigationEntity != null && !string.IsNullOrEmpty(navigationEntity.F_Id))
            {
                ViewBag.NavigationEntity = navigationEntity;
            }
            //获取相关的分类
            if (navigationApp.ExistChild(navigationEntity.F_Id))
            {
                ViewBag.NavigationList = navigationApp.GetChildList(navigationEntity.F_Id, false);
            }
            else
            {
                ViewBag.NavigationList = navigationApp.GetChildList(navigationEntity.F_ParentId, false);
            }
            //相关推荐专题
            ViewBag.SpecialList = specialApp.GetSpecialList(navigationEntity.F_Id, true);
            //文章
            string arrNav = navigationApp.GetChildList(navigationEntity.F_Id, true).Select(a => a.F_Id).ToJson(",").TrimStart('[').TrimEnd(']').Replace("\"", "'");

            IPagedList <ArticleEntity> ArticleList = articleApp.getMvcPageDataList(a => arrNav.Contains(a.F_NavID), a => a.F_CreatorTime, pageIndex, 10);

            if (ArticleList.Count == 0)
            {
                ArticleList = articleApp.getMvcPageDataList(a => a.F_NavID == navigationEntity.F_Id, a => a.F_SortCode, 1, 10);
            }
            //相关专题
            ViewBag.RecommandSpecialList = specialApp.GetSpecialList(navigationEntity.F_Id);
            return(View(ArticleList));
        }
예제 #2
0
        public ActionResult GetGridJson(Pagination pagination, string navId, string keywords)
        {
            List <NavigationEntity> ChildNav = navApp.GetChildList(navId, true);
            string navIds     = ChildNav.Select(a => a.F_Id).ToJson(",").Replace("\"", "'").TrimStart('[').TrimEnd(']');
            var    data       = articleApp.GetList(pagination, navIds, keywords, a => a.F_DeleteMark == false);
            var    returndata = new
            {
                rows    = data,
                total   = pagination.total,
                page    = pagination.page,
                records = pagination.records
            };

            return(Content(returndata.ToJson()));
        }
예제 #3
0
        public PartialViewResult Header()
        {
            var gushiEntity = navApp.GetEntityByEnCode("gushi", a => a.F_EnabledMark == true);

            List <NavigationEntity> NavgushiList = navApp.GetChildList(gushiEntity.F_Id, false).Where(a => a.F_IsNav == true).ToList();

            foreach (NavigationEntity item in NavgushiList)
            {
                NavigationEntity ParentNav = navApp.GetForm(item.F_ParentId);
                if (ParentNav.F_Id == gushiEntity.F_Id)
                {
                    item.PatentEnCode = "";
                }
                else
                {
                    item.PatentEnCode = ParentNav.F_EnCode;
                }
            }
            ViewBag.Navgushi = NavgushiList;
            var wenxueEntity = navApp.GetEntityByEnCode("wenxue", a => a.F_EnabledMark == true);

            ViewBag.Navwenxue = navApp.GetChildList(wenxueEntity.F_Id, false).Where(a => a.F_IsNav == true).ToList();
            return(PartialView());
        }
예제 #4
0
        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());
        }