コード例 #1
0
 public async Task <ActionResult <IEnumerable <Estado> > > GetEstadosAsync()
 {
     try
     {
         return(Ok(await _estadoManager.GetEstadosAsync()));
     }
     catch (Exception ex)
     {
         Exception exception = new Exception("Erro Inesperado.", ex);
         throw;
     }
 }
コード例 #2
0
        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;
            }
        }