public ActionResult Finalizar(int?processoPeticaoId)
        {
            var questionarios   = db.Questionarios.Where(q => q.ProcessoPeticaoId == processoPeticaoId).ToList();
            var processoPeticao = db.ProcessoPeticaos.Find(processoPeticaoId);
            var peticao         = processoPeticao.PeticaoModelo.PeticaoModificada;
            int processoId      = (int)processoPeticao.ProcessoId;

            GerarQuestionario gerarQuestionario = new GerarQuestionario();

            gerarQuestionario.GerarAnexosNoBD((int)processoPeticaoId);


            return(RedirectToAction("TodoProcesso", "Processo", new { id = processoId }));
            //@Html.ActionLink("Voltar", "TodoProcesso", "Processo", new { id = Model.First().ProcessoPeticao.ProcessoId }, null)
        }
Exemple #2
0
        public ActionResult Create([Bind(Include = "ProcessoPeticaoId,ProcessoId,PeticaoModeloId,LinkQuestionario,Comentario,LinkPeticao,Finalizada, DataCadastro")] ProcessoPeticao processoPeticao)
        {
            if (ModelState.IsValid)
            {
                db.ProcessoPeticaos.Add(processoPeticao);
                db.SaveChanges();

                GerarQuestionario gerarQuestionario = new GerarQuestionario();
                //gerarQuestionario.GerarQuestionarioNoBD(processoPeticao.ProcessoPeticaoId);
                gerarQuestionario.GerarQuestionarioNoBD(processoPeticao.ProcessoPeticaoId);
                gerarQuestionario.GerarAnexosNoBD(processoPeticao.ProcessoPeticaoId);

                return(RedirectToAction("TodoProcesso", "Processo", new { id = processoPeticao.ProcessoId }));
            }

            //gerarQuestionario.CriarQuestionario(processoPeticao.PeticaoModeloId);
            //CriarQuestionario(processoPeticao.ProcessoPeticaoId); //linha alterada
            //return RedirectToAction("Index");

            ViewBag.PeticaoModeloId = new SelectList(db.PeticaoModeloes, "PeticaoModeloId", "Nome", processoPeticao.PeticaoModeloId);

            return(View(processoPeticao));
        }