示例#1
0
        /// <summary>
        /// 导航专题分类点击后专题列表页页面
        /// </summary>
        /// <returns></returns>
        public IActionResult List(string id, int pageIndex = 1)
        {
            var topicView = new TopicSearchView();

            topicView.TopicCates = _ArticleTopicService.GetTopicCateList(null, null, true);
            topicView.TopicCount = topicView.TopicCates.Sum(u => u.Childs.Count);
            //精品推荐
            ViewBag.HotTopics = _ArticleTopicService.GetHotTopics(8);

            var cateIds = topicView.TopicCates.Select(u => u.Code).ToList();

            topicView.TopicCount = 0;
            if (!id.IsEmpty())
            {
                ViewBag.TopicCateId = id;
                cateIds             = new List <string>()
                {
                    id
                };
            }
            //todo topic特殊处理,方法重复,但有公用信息待处理
            //topicView.TopicList = _ArticleTopicService.GetCateList(new ArticleTopicSearchView { CateType = 1, ParentId = cateIds.ToArray()}, pageIndex,PageSize);//??
            topicView.TopicList = _ArticleTopicService.GetTopicInfoList(new ArticleTopicSearchView {
                TopicStatus = TopicStatus.Audited, ParentId = cateIds.ToArray()
            }, pageIndex, PageSize);                                                                                                                                                        //??
            return(View(topicView));
        }
示例#2
0
        //首页
        public IActionResult Index([FromServices] IArticleTopicService articleTopicService,
                                   [FromServices] IHelpService helpService, [FromServices] INewsService newsService
                                   , [FromServices] ILinkService linkService, [FromServices] IArticleCategoryService articleCategoryService)
        {
            ViewBag.TodayArticles = _ArticleService.GetTopArticles(ArticleTopEnum.HotArticle, 10);
            ViewBag.NewArticles   = _ArticleService.GetTopArticles(ArticleTopEnum.NewArticle, 10);

            ViewBag.HotTopics = articleTopicService.GetHotTopics(8);

            ViewBag.BestCates = articleCategoryService.GetCateList(new ArticleCateSearchView {
                IsRemmand = true
            }, 1, 6);

            var tradeScores = _IMemberScoreService.GetList(true, 5);

            ViewBag.TradeScores = tradeScores;
            //PPT
            ViewBag.HotPPT = _ArticleService.GetTopArticles(ArticleTopEnum.HotPPT, 18, null);
            ViewBag.NewPPT = _ArticleService.GetTopArticles(ArticleTopEnum.NewPPT, 18, null);

            //轮播图
            ViewBag.HomeCarousels = helpService.GetHelps(new HelpSearchView()
            {
                HelpCode = HelpCode.HomeCarousel
            }, 1, 10).ToList();
            //公告
            ViewBag.Announcements = newsService
                                    .GetTopNewss(NewsTopEnum.Announcement, 5).ToList();
            //资源总数量
            var totalData = _ArticleService.GetTotalBooks();

            ViewBag.TotalBooks = totalData;


            //友情链接
            ViewBag.FriendLinks = linkService.GetList();


            return(View());
        }