Example #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));
        }
Example #2
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());
        }
Example #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());
        }
Example #4
0
        public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values)
        {
            var ArticleId = values["id"] as string;
            var Page      = values["pageIndex"];

            if (values["pageIndex"] != null)
            {
                Page = values["pageIndex"].ToString();
            }
            if (Page == null)
            {
                Page = "1";
            }

            //请求不是NavigationController发起的,不是我们要处理的请求,返回null
            if (!values.ContainsKey("controller") || !values["controller"].ToString().Equals("Articles", StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }
            //请求不是NavigationController.Index(string id)发起的,不是我们要处理的请求,返回null
            if (!values.ContainsKey("action") || !values["action"].ToString().Equals("Index", StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }

            ArticleEntity articleEntity = articleApp.GetFormByEnCode(ArticleId);


            if (articleEntity == null || !Validate.IsGuid(articleEntity.F_Id))
            {
                throw new ArgumentNullException("Article");
            }

            NavigationEntity navigationEntity = navigationApp.GetForm(articleEntity.F_NavID);

            var path = navigationEntity.F_EnCode + "/" + articleEntity.F_EnCode.Trim();//生成URL

            if (Page + "" != "1")
            {
                path = path + "/page-" + Page;
            }

            return(new VirtualPathData(this, path.ToLowerInvariant()));
        }
Example #5
0
        public ActionResult Index(string id, int pageIndex = 1)
        {
            ArticleEntity articleEntity = articleApp.GetFormByEnCode(id);

            if (!articleEntity.F_SaveStyle)
            {
                string filePath = System.Web.HttpContext.Current.Request.PhysicalApplicationPath
                                  + "\\" + articleEntity.F_ContentLink;
                //文本
                articleEntity.F_Content = FileHelper.ReaderFile(filePath);
            }

            articleEntity.NavEntity = navigationApp.GetForm(a => a.F_Id == articleEntity.F_NavID);
            //文章处理
            string[] split   = { "_ueditor_page_break_tag_" };
            string[] Content = articleEntity.F_Content.Split(split, StringSplitOptions.RemoveEmptyEntries);
            articleEntity.F_Content = Content[pageIndex - 1];
            IPagedList <string> contentList = Content.ToList().ToPagedList(pageIndex, 1);

            ViewBag.contentList = contentList;
            //精华推荐
            ViewBag.Isrecommend = articleApp.GetList(a => a.F_Isrecommend == true && a.F_EnabledMark == true && !string.IsNullOrEmpty(a.F_ImgUrl), 5);
            return(View(articleEntity));
        }
Example #6
0
        public ActionResult GetNavFormJson(string keyValue)
        {
            var data = navApp.GetForm(keyValue);

            return(Content(data.ToJson()));
        }