public Retorno.AoRealizarLocalizaAutor Realizar(Operacao.LocalizaAutor localizaAutor) { var retorno = new Retorno.AoRealizarLocalizaAutor(); var retornoAoLocalizarEmRepositorioAutor = repAutor.Localizar(localizaAutor.AutorId); if (retornoAoLocalizarEmRepositorioAutor.Problemas.Count > 0) { retorno.Mensagem = "Não foi possível localizar o autor."; retorno.Problemas.AddRange(retornoAoLocalizarEmRepositorioAutor.Problemas); } else { retorno.Autor = AutorDTO.Fabricar(retornoAoLocalizarEmRepositorioAutor.Autor); } return(retorno); }
public Retorno.AoRealizarListaAutores Realizar(Operacao.ListaAutores listaAutores) { var retorno = new Retorno.AoRealizarListaAutores(); var retornoAoListarDeRepositorioAutor = repAutor.Listar(); if (retornoAoListarDeRepositorioAutor.Problemas.Count > 0) { retorno.Mensagem = "Não foi possível listar os autores."; retorno.Problemas.AddRange(retornoAoListarDeRepositorioAutor.Problemas); } else { retorno.Autores = new List <AutorDTO>(); foreach (var autor in retornoAoListarDeRepositorioAutor.Autores) { retorno.Autores.Add(AutorDTO.Fabricar(autor)); } } return(retorno); }
public RetornoBase <List <AutorDTO> > Realizar(Operacao.ListaAutoresDisponiveis listaAutoresDisponiveis) { var retorno = new RetornoBase <List <AutorDTO> >(); var aoListarAutoresDisponiveis = repLivro.ListarAutoresDisponiveis(listaAutoresDisponiveis.LivroId); if (aoListarAutoresDisponiveis.Problemas.Count > 0) { retorno.Mensagem = "Não foi possível listar os autores disponíveis."; retorno.Problemas.AddRange(aoListarAutoresDisponiveis.Problemas); } else { retorno.Valor = new List <AutorDTO>(); foreach (var autor in aoListarAutoresDisponiveis.Valor) { retorno.Valor.Add(AutorDTO.Fabricar(autor)); } } return(retorno); }