Exemple #1
0
        //[ValidateAntiForgeryToken]
        public ActionResult Edit(SolicitacaoViewModel model)
        {
            try
            {
                var solicitacao = model.MapearParaObjetoDominio();
                solicitacao.Atualizacao = DateTime.Now;
                solicitacao.Atualizador = User.Identity.Name;

                UploadFilesHandler(model, model.IdPessoa);

                solicitacao.CertAntCrimPCFilePath = model.CertAntCrimPCFilePath;
                solicitacao.CertAntCrimPFFilePath = model.CertAntCrimPFFilePath;
                solicitacao.CertTJBAFilePath      = model.CertTJBAFilePath;
                solicitacao.CertTRFFilePath       = model.CertTRFFilePath;

                SolicitacaoService.AtualizarAnexos(solicitacao);

                return(Json(new
                {
                    success = true,
                    title = "Sucesso",
                    message = "Anexos cadastrados com sucesso !"
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    success = false,
                    title = "Erro",
                    message = ex.Message
                }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #2
0
        //[ValidateAntiForgeryToken]
        public ActionResult Create(SolicitacaoViewModel model)
        {
            try
            {
                var solicitacao = model.MapearParaObjetoDominio();

                solicitacao.Criador         =
                    solicitacao.Atualizador = User.Identity.Name;

                UploadFilesHandler(model, solicitacao.PessoaId.Value);

                solicitacao.CertAntCrimPCFilePath = model.CertAntCrimPCFilePath;
                solicitacao.CertAntCrimPFFilePath = model.CertAntCrimPFFilePath;
                solicitacao.CertAntCrimPFFilePath = model.CertTJBAFilePath;
                solicitacao.CertTRFFilePath       = model.CertTRFFilePath;

                SolicitacaoService.Salvar(solicitacao);

                return(Json(new
                {
                    success = true,
                    title = "Sucesso",
                    message = "Solicitação cadastrada com sucesso !"
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    success = false,
                    title = "Erro",
                    message = ex.Message
                }, JsonRequestBehavior.AllowGet));
            }
        }