Beispiel #1
0
        public HttpResponseMessage ListarBancos()
        {
            try
            {
                var model  = new List <BancoViewModel>();
                var result = _financeiroService.ListarBancos();

                if (result.Count > 0)
                {
                    foreach (var item in result)
                    {
                        model.Add(new BancoViewModel()
                        {
                            IdBanco   = item.IdBanco,
                            NomeBanco = item.NomeBanco,
                            Codigo    = item.Codigo
                        });
                    }
                }
                return(Request.CreateResponse(HttpStatusCode.OK, model));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }