public object GerarPedido([FromBody] GerarPedidoEntrada request) { var result = new GerarPedidoEntrada(request.idPedido, request.Cliente, request.livros, DateTime.Now); /* mediator não funciona na minha versão de VSS2017 pq precisa de .net core acima de 2.1 */ /* * await mediator.PublishAsync(result) * .ConfigureAwait(false); */ return(result); }
public async Task Executar(GerarPedidoEntrada entrada) { if (entrada is null) { this._GerarPedidoSaidaPort.WriteError("Entrada não pode ser nula"); return; } ICarrinhoLivro CarrinhoLivro = await this._CarrinhoRepository.GetCarrinhoLivro().ConfigureAwait(false); if (CarrinhoLivro is null) { this._GerarPedidoSaidaPort.WriteError("Carrinho não existe."); return; } IPedido pedido = await this._CarrinhoService.GerarPedido(CarrinhoLivro, entrada.livros, entrada.Cliente); await this._unitOfWork.Save().ConfigureAwait(false); this.BuildOutput(pedido); }