示例#1
0
        public async Task <IActionResult> CategoryPosts(long?categoryId, int?page)
        {
            var postsForCategory = _homePageService.ApprovedPostsForCategory(categoryId);
            int pageSize         = 5;
            var category         = _categoryService.getById(categoryId).Result.CategoryName;

            ViewData["Title"]      = category;
            ViewData["Header"]     = category;
            ViewData["CategoryId"] = categoryId;
            return(View(await PaginatedList <Post> .CreateAsync(postsForCategory, page ?? 1, pageSize)));
        }