public IActionResult Index( int?page, string searchString, int?postCategoryId, string postTag, PostSortFilterType postSortFilterType = PostSortFilterType.SortByDateDesc) { var postSearch = new PostSearch() { SearchString = searchString, PostCategoryId = postCategoryId, PostTag = postTag, PostSortFilterType = postSortFilterType, }; int pageSize = 6; var posts = GetPosts(postSearch, pageIndex: page - 1 ?? 0, pageSize: pageSize); var blogViewModel = new PostsViewModel() { PostViewModels = _mapper.Map <IEnumerable <Post>, IEnumerable <PostViewModel> >(posts), Pager = new Pager(posts.TotalCount, posts.TotalPages, page, pageSize), SearchString = searchString, PostCategoryId = postCategoryId, PostTag = postTag, PostSortFilterType = postSortFilterType }; return(View(blogViewModel)); }
public IActionResult Index(int?page, int?postCategoryId, PostSortFilterType postSortFilterType = PostSortFilterType.SortByDateDesc) { var postSearch = new PostSearch() { PostCategoryId = postCategoryId, PostTag = null, PostSortFilterType = postSortFilterType }; int pageSize = 12; var posts = GetPosts(PostCategoryType.Portfolio, postSearch, pageIndex: page - 1 ?? 0, pageSize: pageSize); var postsViewModel = new PostsViewModel() { PostViewModels = _mapper.Map <IEnumerable <Post>, IEnumerable <PostViewModel> >(posts), Pager = new Pager(posts.TotalCount, posts.TotalPages, page, pageSize), PostCategoryId = postCategoryId, PostTag = null, PostSortFilterType = postSortFilterType }; return(View(postsViewModel)); }