Exemplo n.º 1
0
        // 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));
        }
Exemplo n.º 2
0
        // 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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        // 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));
        }