public ActionResult DeleteConfirmed(int id)
        {
            TB_Questoes tB_Questoes = db.TB_Questoes.Find(id);

            db.TB_Questoes.Remove(tB_Questoes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "QuestaoId,PesquisaId,Questao,TipoRespostaId,Obrigatorio")] TB_Questoes tB_Questoes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tB_Questoes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PesquisaId     = new SelectList(db.TB_Pesquisa, "PesquisaId", "Titulo", tB_Questoes.PesquisaId);
     ViewBag.TipoRespostaId = new SelectList(db.TB_TipoResposta, "TipoRespostaId", "TipoResposta", tB_Questoes.TipoRespostaId);
     return(View(tB_Questoes));
 }
        public ActionResult Create([Bind(Include = "QuestaoId,PesquisaId,Questao,TipoRespostaId")] TB_Questoes tB_Questoes)
        {
            if (ModelState.IsValid)
            {
                db.TB_Questoes.Add(tB_Questoes);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.PesquisaId     = new SelectList(db.TB_Pesquisa, "PesquisaId", "Titulo", tB_Questoes.PesquisaId);
            ViewBag.TipoRespostaId = new SelectList(db.TB_TipoResposta, "TipoRespostaId", "TipoResposta", tB_Questoes.TipoRespostaId);
            return(View(tB_Questoes));
        }
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TB_Questoes tB_Questoes = db.TB_Questoes.Find(id);

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

            if (tB_Questoes == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PesquisaId     = new SelectList(db.TB_Pesquisa, "PesquisaId", "Titulo", tB_Questoes.PesquisaId);
            ViewBag.TipoRespostaId = new SelectList(db.TB_TipoResposta, "TipoRespostaId", "TipoResposta", tB_Questoes.TipoRespostaId);
            return(View(tB_Questoes));
        }
        public ActionResult Edit(int?id)
        {
            var Perfil = int.Parse(Session["Perfil"].ToString());

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

            if (tB_Questoes == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PesquisaId     = new SelectList(from s in db.TB_Pesquisa join c in db.TB_PesquisaPerfil on s.PesquisaId equals c.PesquisaId where c.PerfilId == Perfil select s, "PesquisaId", "Titulo", tB_Questoes.PesquisaId);
            ViewBag.TipoRespostaId = new SelectList(db.TB_TipoResposta, "TipoRespostaId", "TipoResposta", tB_Questoes.TipoRespostaId);
            return(View(tB_Questoes));
        }