Ejemplo n.º 1
0
        public IActionResult Index(PaginationInfo paginationInfo)
        {
            var posts     = _service.GetPostsWithCommentCount();
            var paginated = _paginationService.Paginate(posts, paginationInfo);

            var viewModel = new PostPagesViewModel()
            {
                Posts     = paginated.PagedItems,
                PostPager = paginated.Pager
            };

            return(View(viewModel));

            //return View();
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Users([FromQuery] PaginationInfo paginationInfo)
        {
            var paginated   = _paginationService.Paginate(_accountService.GetAllUsers(), paginationInfo);
            var currentUser = await _accountService.GetCurrentUserAsync(HttpContext.User);

            var userRoles = await _accountService.GetRolesAsync(currentUser);

            UserDetailsViewModel viewModel = new UserDetailsViewModel()
            {
                Pager      = paginated.Pager,
                PagedUsers = _mapper.Map <IEnumerable <UserInfoViewModel> >(paginated.PagedItems)
            };

            return(View(viewModel));
        }
Ejemplo n.º 3
0
        public IActionResult GetAll([FromQuery] PaginationInfo paginationInfo)
        {
            var comments  = _service.GetCommentsWithUser();
            var paginated = _paginationService.Paginate(comments, paginationInfo);

            var viewModel = new
            {
                Comments     = paginated.PagedItems,
                CommentPager = paginated.Pager
            };

            return(new OkObjectResult(new ApiResponse <object> {
                Data = viewModel, Message = "200 OK"
            }));
        }
Ejemplo n.º 4
0
 public IPaginatedResults <Article> SearchArticles(NewsSearchConfiguration config)
 {
     return(_paginationService.Paginate(ArticlesFromApi(config), config.Page, PageSize));
 }
Ejemplo n.º 5
0
 public IPaginatedResults <Article> SearchArticles(NewsSearchConfiguration config)
 {
     return(_paginationService.Paginate(TestArticles(), 1, PageSize));
 }