예제 #1
0
        public async Task <IActionResult> Type(int id, int page = 1)
        {
            //获取类型
            var type = await _blogAppService.GetArticleTypeByIdAsync(id);

            //如果没有分类信息就不需要查询文章
            if (type != null)
            {
                //传递类型ID
                ViewBag.ArticleTypeId = type.Id;
                //获取文章详情
                int pageSize = 10;
                ViewBag.Articles = await _blogAppService.GetArticlesByTypeIdAsync(id, page, pageSize);

                ViewBag.Page = page;
                int maxCount = ViewBag.Articles.TotalCount / pageSize;
                if (ViewBag.Articles.TotalCount % pageSize > 0)
                {
                    maxCount++;
                }
                ViewBag.MaxPage = maxCount;
                blogSite.Title  = $"{type.Name}-文章分类-{blogSite.SiteName}";
            }
            ViewBag.MessBox = "暂无此分类信息";
            return(await ViewAsync("Articles"));
        }
예제 #2
0
        public async Task <ActionResult> EditArticleTypeModal(int articleTypeId)
        {
            var articleType = await _blogAppService.GetArticleTypeByIdAsync(articleTypeId);

            return(View("_EditArticleTypeModal", articleType));
        }