public async Task <PaginatedList <ProductDto> > Handle(GetProductsWithPaginationQuery request, CancellationToken cancellationToken) { return(await _context.Products .Include(x => x.ProductType) .OrderBy(x => x.Name) .ProjectTo <ProductDto>(_mapper.ConfigurationProvider) .PaginatedListAsync(request.PageNumber, request.PageSize)); }
public async Task <PaginatedList <ProductDto> > GetProducts([FromQuery] GetProductsWithPaginationQuery query) { return(await Mediator.Send(query)); }