public async Task <IActionResult> CategoryFilter(BlogForCategoryFilterDto blogForCategoryFilterDto) { await InitializeModel(); model.EntriesPaging = await _entryRepo.CategoryFilter(blogForCategoryFilterDto); if (!String.IsNullOrEmpty(blogForCategoryFilterDto.searchString)) { return(RedirectToAction("BlogList", "Blog", new { blogForCategoryFilterDto.searchString })); } model.EntriesPaging = await _entryRepo.CategoryFilter(blogForCategoryFilterDto); return(View("~/Views/Blog/BlogList.cshtml", model)); }
public async Task <IPagedList <TEntry> > CategoryFilter(BlogForCategoryFilterDto blogForCategoryFilterDto) { int no = blogForCategoryFilterDto.page ?? 1; int size = blogForCategoryFilterDto.pageSize ?? 4; var entries = await EntriesAll(); var entriesPaging = entries.ToPagedList(size, no); if (!String.IsNullOrEmpty(blogForCategoryFilterDto.category)) { entriesPaging = entries.Where(s => s.Category == blogForCategoryFilterDto.category).ToPagedList(size, no); } return(entriesPaging); }