示例#1
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));
            }
        }