Exemplo n.º 1
0
        public HttpResponseMessage ListarCheques()
        {
            try
            {
                var result = new List <ChequeViewModel>();

                var model = _financeiroService.ListarCheques(base.GetUsuarioLogado().IdClinica);
                if (model.Count > 0)
                {
                    Mapper.CreateMap <Cheque, ChequeViewModel>();
                    Mapper.CreateMap <Pessoa, PessoaViewModel>();
                    Mapper.CreateMap <Financeiro, FinanceiroViewModel>();
                    result = Mapper.Map <List <Cheque>, List <ChequeViewModel> >(model.ToList());
                }

                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }