// GET: search/post5/page5 public ActionResult Search(string search, int page = 1) { List <PostModel> posts = Mapper.Map <IEnumerable <PostDTO>, List <PostModel> >(postService.SearchPosts(search, SearchType.TitleAndCategory, page, pageSize)); PagingInfo pagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = postService.TotalItems }; PostListModelView model = new PostListModelView() { Posts = posts, PagingInfo = pagingInfo, CurrentSearch = search }; return(View("List", model)); }
// GET: tag/tag5/5 public ActionResult PostsForTag(string tag, int page = 1) { List <PostModel> posts = Mapper.Map <IEnumerable <PostDTO>, List <PostModel> >(postService.SearchPosts(tag, SearchType.Tag, page, pageSize).OrderByDescending(p => p.PostedOn)); PagingInfo pagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = postService.TotalItems }; PostListModelView model = new PostListModelView() { Posts = posts, PagingInfo = pagingInfo, CurrentSearch = tag }; return(View("List", model)); }
public ActionResult List(string category, int page = 1) { List <PostModel> posts = Mapper.Map <IEnumerable <PostDTO>, List <PostModel> >(postService.GetPosts(category, page, pageSize)); PagingInfo pagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = postService.TotalItems }; PostListModelView model = new PostListModelView() { Posts = posts, PagingInfo = pagingInfo, CurrentSearch = category }; return(View(model)); }
// GET: user/login5/5 public ActionResult PostsForUserModal(string id, int page = 1) { int userPageSize = 10; List <PostModel> posts = Mapper.Map <IEnumerable <PostDTO>, List <PostModel> >(postService.SearchPosts(id, SearchType.User, page, userPageSize).OrderByDescending(p => p.PostedOn)); PagingInfo pagingInfo = new PagingInfo { CurrentPage = page, ItemsPerPage = userPageSize, TotalItems = postService.TotalItems }; PostListModelView model = new PostListModelView() { Posts = posts, PagingInfo = pagingInfo, CurrentSearch = id }; return(View(model)); }