public Retorno.AoRealizarNovoAutor Realizar(Operacao.NovoAutor novoAutor) { var retorno = new Retorno.AoRealizarNovoAutor(); var autor = novoAutor.Fabricar(); if (autor.EstaEmEstadoIntegro()) { var retornoAoInserirEmRepositorioAutor = repAutor.Inserir(autor); if (retornoAoInserirEmRepositorioAutor != null) { retorno.AutorId = retornoAoInserirEmRepositorioAutor.AutorId; if (retornoAoInserirEmRepositorioAutor.Problemas.Count > 0) { retorno.Mensagem = "Não foi possível registrar o novo autor."; retorno.Problemas.AddRange(retornoAoInserirEmRepositorioAutor.Problemas); } } else { retorno.Mensagem = "Não foi possível registrar o novo autor."; } } else { retorno.Mensagem = "Os dados do novo autor não foram devidamente informados."; retorno.Problemas.AddRange(autor.Problemas); } return(retorno); }
public ProtocoloDeRetorno.AoRealizarNovoAutor Realizar(NovoAutor novoAutor) { var retorno = new ProtocoloDeRetorno.AoRealizarNovoAutor(); var autor = new Autor(0, new TNomePessoa(novoAutor.Nome, novoAutor.Sobrenome), new TEmail(novoAutor.Email)); if (autor.EstaEmEstadoIntegro()) { var retornoAoInserirEmRepositorioAutor = repAutor.Inserir(autor); retorno.AutorId = retornoAoInserirEmRepositorioAutor.AutorId; if (retornoAoInserirEmRepositorioAutor.Problemas.Count > 0) { retorno.Mensagem = "Não foi possível registrar o novo autor."; retorno.Problemas.AddRange(retornoAoInserirEmRepositorioAutor.Problemas); } } else { retorno.Mensagem = "Os dados do novo autor não foram devidamente informados."; retorno.Problemas.AddRange(autor.Problemas); } return(retorno); }