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

            var orders = pagedResult.Items.Select(o => new OrderDto()
            {
                Id          = o.Id,
                ItemsCount  = o.Cart.Items.Count(),
                TotalAmount = o.TotalAmount,
                Status      = o.Status
            }).ToList();

            return(PagedResults <OrderDto> .From(pagedResult, orders));
        }
Пример #2
0
        public async Task <PagedResult <OrderDto> > HandleAsync(BrowseOrders query)
        {
            var pagedResult = await _ordersRepository.BrowseAsync(query);

            var orders = pagedResult.Items.Select(o => new OrderDto
            {
                Id          = o.Id,
                CustomerId  = o.CustomerId,
                ItemsCount  = o.Items.Count(),
                TotalAmount = o.TotalAmount,
                Currency    = o.Currency,
                Status      = o.Status.ToString().ToLowerInvariant()
            });

            return(PagedResult <OrderDto> .From(pagedResult, orders));
        }
Пример #3
0
 public async Task <IActionResult> Get([FromQuery] BrowseOrders query)
 => Collection(await _ordersRepository.BrowseAsync(query));