示例#1
0
        public async Task Executar(EditarLivroEntrada entrada)
        {
            if (entrada is null)
            {
                this._EditarLivroSaidaPort.WriteError("Entrada não pode ser nula");
                return;
            }

            ICadastroLivro CadastroLivro = await this._CadastroLivroRepository.GetCadastroLivro().ConfigureAwait(false);

            if (CadastroLivro is null)
            {
                this._EditarLivroSaidaPort.WriteError("Cadastro de livros não existe.");
                return;
            }


            ILivro livro = await this._CadastroLivroService.AlterarLivro(CadastroLivro,
                                                                         new Livro()
            {
                isbn  = entrada.isbn,
                autor = entrada.autor,
                nome  = entrada.nome,
                preco = entrada.preco
            });


            await this._unitOfWork.Save().ConfigureAwait(false);

            this.BuildOutput(livro.isbn.id);
        }
示例#2
0
        public Object Put(int id, [FromBody] EditarLivroEntrada request)
        {
            var result = new EditarLivroEntrada(request.isbn.id, request.nome, request.preco, request.autor);

            /* mediator não funciona na minha versão de VSS2017 pq precisa de .net core acima de 2.1 */

            /*
             * await mediator.PublishAsync(inputmediator)
             *      .ConfigureAwait(false); */

            return(result);
        }