コード例 #1
0
        public HttpResponseMessage PesquisarPlanoContas(string nome, int?codigo, string tipo)
        {
            try
            {
                var model  = new List <PlanoContaViewModel>();
                var result = _financeiroService.PesquisarPlanoContas(nome, codigo, tipo, base.GetUsuarioLogado().IdClinica);

                foreach (var item in result)
                {
                    model.Add(new PlanoContaViewModel()
                    {
                        IdPlanoConta = item.IdPlanoConta,
                        NmPlanoConta = item.NmPlanoConta,
                        Categoria    = item.Categoria,
                        Codigo       = item.Codigo,
                        Tipo         = item.Tipo,
                        Situacao     = item.Situacao
                    });
                }
                return(Request.CreateResponse(HttpStatusCode.OK, model));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }