public async Task <ICollection <ProdutorDto> > GetAll()
        {
            var produtores = await _produtorRepository.GetAll();

            return(produtores.Select(produtor => new ProdutorDto()
            {
                Id = produtor.Id, Nome = produtor.Nome
            }).ToList());
        }
Beispiel #2
0
 public ActionResult GetAll([FromHeader] string ibge)
 {
     try
     {
         ibge = _config.GetConnectionString(Connection.GetConnection(ibge));
         List <Produtor> lista = _repository.GetAll(ibge);
         return(Ok(lista));
     }
     catch (Exception ex)
     {
         var response = TrataErro.GetResponse(ex.Message, true);
         return(StatusCode((int)HttpStatusCode.InternalServerError, response));
     }
 }