public ActionResult Edit(int?id, int?PesquisaId)
        {
            var Perfil = int.Parse(Session["Perfil"].ToString());

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TB_Alternativas TB_Alternativas = db.TB_Alternativas.Find(id);

            if (TB_Alternativas == null)
            {
                return(HttpNotFound());
            }
            var lstPesquisa = (from s in db.TB_Pesquisa
                               join c in db.TB_PesquisaPerfil on s.PesquisaId equals c.PesquisaId
                               where c.PerfilId == Perfil
                               select s);

            ViewBag.PesquisaId = new SelectList(lstPesquisa, "PesquisaId", "Titulo", PesquisaId);

            PesquisaId = PesquisaId ?? lstPesquisa.FirstOrDefault().PesquisaId;

            var lstQuestao = (from s in db.TB_Questoes
                              join c in db.TB_PesquisaPerfil on s.TB_Pesquisa.PesquisaId equals c.PesquisaId
                              where c.PerfilId == Perfil && s.PesquisaId == PesquisaId
                              select s);

            ViewBag.QuestaoId = new SelectList(lstQuestao, "QuestaoId", "Questao");

            return(View(TB_Alternativas));
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            TB_Alternativas TB_Alternativas = db.TB_Alternativas.Find(id);

            db.TB_Alternativas.Remove(TB_Alternativas);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#3
0
 public ActionResult Edit([Bind(Include = "AlternativaId,QuestaoId,Alternativa")] TB_Alternativas TB_Alternativas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(TB_Alternativas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.QuestaoId = new SelectList(db.TB_Questoes, "QuestaoId", "Questao", TB_Alternativas.QuestaoId);
     return(View(TB_Alternativas));
 }
示例#4
0
        // GET: TB_Alternativas/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TB_Alternativas TB_Alternativas = db.TB_Alternativas.Find(id);

            if (TB_Alternativas == null)
            {
                return(HttpNotFound());
            }
            return(View(TB_Alternativas));
        }
示例#5
0
        // GET: TB_Alternativas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TB_Alternativas TB_Alternativas = db.TB_Alternativas.Find(id);

            if (TB_Alternativas == null)
            {
                return(HttpNotFound());
            }
            ViewBag.QuestaoId = new SelectList(db.TB_Questoes, "QuestaoId", "Questao", TB_Alternativas.QuestaoId);
            return(View(TB_Alternativas));
        }