Esempio n. 1
0
        public async Task <PaginatedList <ProjectDto> > Handle(GetProjectsWithPaginationQuery request, CancellationToken cancellationToken)
        {
            try
            {
                var projects = await _dbContext.Projects
                               .OrderBy(x => x.Title)
                               .ProjectTo <ProjectDto>(_mapper.ConfigurationProvider)
                               .PaginatedListAsync(request.PageNumber, request.PageSize);

                return(projects);
            }
            catch (Exception ex)
            {
                throw new Exception("There was an error getting the projects with pagination", ex);
            }
        }
Esempio n. 2
0
        public async Task <ActionResult <PaginatedList <ProjectDto> > > GetProjectsWithPagination([FromQuery] GetProjectsWithPaginationQuery project)
        {
            var result = await Mediator.Send(project);

            return(Ok(result));
        }