Exemplo n.º 1
0
        public async Task<IEnumerable<OrderResponse>> Handle(GetOrdersBySellerUsernameQuery request, CancellationToken cancellationToken)
        {
            var orderList = await _orderRepository.GetOrdersBySellerUserName(request.UserName);

            var response = _mapper.Map<IEnumerable<OrderResponse>>(orderList);

            return response;
        }
        public async Task <ActionResult <IEnumerable <OrderResponse> > > GetOrdersByUserName(string userName)
        {
            var query = new GetOrdersBySellerUsernameQuery(userName);

            var orders = await _mediator.Send(query);

            if (orders.Count() == decimal.Zero)
            {
                return(NotFound());
            }

            return(Ok(orders));
        }