예제 #1
0
        public async Task <OrderGetResult> Get(OrderGetCommand command)
        {
            var order = await orderRepository.GetByIdWithItemsAsync(command.Id);

            if (order == null)
            {
                throw new OrderNotFoundException(command.Id, "注文が見つかりませんでした。");
            }

            return(new OrderGetResult(order));
        }
예제 #2
0
        public async Task <IActionResult> Get(int orderId)
        {
            var command = new OrderGetCommand(orderId);

            var result = await this._mediator.Send(command);

            if (result.Status == CommandResultStatus.Success)
            {
                return(new OkObjectResult(result.Result));
            }

            return(new BadRequestResult());
        }
 private async Task init()
 {
     var orderGetCommand = new OrderGetCommand(OrderId);
     var orderGetResult = await orderApplicationService.Get(orderGetCommand);
     order = orderGetResult.Order;
 }