Exemplo n.º 1
0
        public async Task <OrderResponse> Handle(CheckoutOrderCommand request, CancellationToken cancellationToken)
        {
            var orderEntity = OrderMapper.Mapper.Map <Order>(request);

            if (orderEntity == null)
            {
                throw new ApplicationException("Not mapped");
            }

            var newOrder = await _orderRepository.AddAsysnc(orderEntity);

            var orderReponse = OrderMapper.Mapper.Map <OrderResponse>(newOrder);

            return(orderReponse);
        }