public ActionResult DeleteConfirmed(int id, int?id2)
        {
            if ((Session["Userid"] == null) || (!Session["UserSupervisor"].Equals("1")))
            {
                return(RedirectToAction("Index", "Home", new { area = "" }));
            }
            Alunodisciplina alunodisciplina = db.Alunodisciplinas.Find(id, id2);

            db.Alunodisciplinas.Remove(alunodisciplina);
            db.SaveChanges();
            return(RedirectToAction("Index", new { id = id2 }));
        }
 public ActionResult Edit([Bind(Include = "iddisciplina,idaluno")] Alunodisciplina alunodisciplina)
 {
     if ((Session["Userid"] == null) || (!Session["UserSupervisor"].Equals("1")))
     {
         return(RedirectToAction("Index", "Home", new { area = "" }));
     }
     if (ModelState.IsValid)
     {
         db.Entry(alunodisciplina).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idaluno      = new SelectList(db.Alunoes, "idaluno", "nome", alunodisciplina.idaluno);
     ViewBag.iddisciplina = new SelectList(db.Disciplinas, "iddisciplina", "descricao", alunodisciplina.iddisciplina);
     return(View(alunodisciplina));
 }
        // GET: Alunodisciplinas/Details/5
        public ActionResult Details(int?id)
        {
            if ((Session["Userid"] == null) || (!Session["UserSupervisor"].Equals("1")))
            {
                return(RedirectToAction("Index", "Home", new { area = "" }));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Alunodisciplina alunodisciplina = db.Alunodisciplinas.Find(id);

            if (alunodisciplina == null)
            {
                return(HttpNotFound());
            }
            return(View(alunodisciplina));
        }
        // GET: Alunodisciplinas/Edit/5
        public ActionResult Edit(int?id, int?idaluno)
        {
            if ((Session["Userid"] == null) || (!Session["UserSupervisor"].Equals("1")))
            {
                return(RedirectToAction("Index", "Home", new { area = "" }));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Alunodisciplina alunodisciplina = db.Alunodisciplinas.Find(id, idaluno);

            if (alunodisciplina == null)
            {
                return(HttpNotFound());
            }
            ViewBag.idaluno      = new SelectList(db.Alunoes, "idaluno", "nome", alunodisciplina.idaluno);
            ViewBag.iddisciplina = new SelectList(db.Disciplinas, "iddisciplina", "descricao", alunodisciplina.iddisciplina);
            return(View(alunodisciplina));
        }
        // GET: Alunodisciplinas/Delete/5
        public ActionResult Delete(int?id, int?id2)
        {
            ViewBag.idDelete = id2;
            if ((Session["Userid"] == null) || (!Session["UserSupervisor"].Equals("1")))
            {
                return(RedirectToAction("Index", "Home", new { area = "" }));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Alunodisciplina alunodisciplina = db.Alunodisciplinas.Find(id, id2);

            if (alunodisciplina == null)
            {
                return(HttpNotFound());
            }
            alunodisciplina.aluno      = db.Alunoes.Find(id2);
            alunodisciplina.disciplina = db.Disciplinas.Find(id);
            return(View(alunodisciplina));
        }