コード例 #1
0
        //
        // GET: /Orcamento/Details/5
        public ActionResult Detalhes(int id, string usuarioId)
        {
            try
            {
                _userId = usuarioId;
                var orcamentoEntity = Mapper.Map <Orcamento, OrcamentoViewModel>(_orcamentoApp.GetById(id));
                var servico         = _servicoApp.GetById(orcamentoEntity.serv_Id);
                ViewBag.Servico   = servico.serv_Nome;
                ViewBag.UsuarioId = usuarioId;

                return(View(orcamentoEntity));
            }
            catch (Exception e)
            {
                var logVm = new LogViewModel();
                logVm.Mensagem   = e.Message;
                logVm.Controller = "Orçamento";
                logVm.View       = "Detalhes Get";

                var log = Mapper.Map <LogViewModel, Log>(logVm);



                _logAppService.SaveOrUpdate(log);
                return(RedirectToAction("ErroAoCadastrar"));
            }
        }
コード例 #2
0
        public JsonResult ObterOrcamento(int id)
        {
            try
            {
                Orcamento orcamento = _orcamentoAppService.GetById(id);

                OrcamentoViewModel orcamentoViewModel = new OrcamentoViewModel();

                orcamentoViewModel.OrcamentoId          = orcamento.Id;
                orcamentoViewModel.OrcamentoTipo        = orcamento.Tipo;
                orcamentoViewModel.OrcamentoMes         = orcamento.Mes;
                orcamentoViewModel.OrcamentoAno         = orcamento.Ano;
                orcamentoViewModel.OrcamentoValor       = orcamento.Valor;
                orcamentoViewModel.OrcamentoCategoriaId = orcamento.CategoriaId;

                return(Json(orcamentoViewModel, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, responseText = ex.InnerException }, JsonRequestBehavior.AllowGet));
            }
        }