Пример #1
0
        public async Task <PagedResults <ProductDto> > HandleAsync(BrowseProductsQuery query)
        {
            var pagedResult = await _productsRepository.BrowseAsync(query);

            var products = pagedResult.Items.Select(p => new ProductDto()
            {
                Id          = p.Id,
                Name        = p.Name,
                Description = p.Description,
                Vendor      = p.Vendor,
                Price       = p.Price,
                Quantity    = p.Quantity
            }).ToList();

            return(PagedResults <ProductDto> .From(pagedResult, products));
        }
 public async Task <IActionResult> Get(BrowseProducts query)
 => Collection(await _productsRepository.BrowseAsync(query));