public async Task <ActionResult <IEnumerable <Estado> > > GetEstadosAsync() { try { return(Ok(await _estadoManager.GetEstadosAsync())); } catch (Exception ex) { Exception exception = new Exception("Erro Inesperado.", ex); throw; } }
public async Task <ActionResult <IEnumerable <EstadoView> > > GetEstadosAsync() { try { var listaEstado = new List <EstadoView>(); var estados = await _estadoManager.GetEstadosAsync(); foreach (var estado in estados) { listaEstado.Add(new EstadoView(estado)); } return(Ok(listaEstado)); } catch (Exception ex) { Exception exception = new Exception("Erro inesperado", ex); throw exception; } }