// GET: updateadvisor public ActionResult updateadvisor() { if (Session["id"] == null) { return(RedirectToAction("login", "login")); } else { var id = Session["id"]; var name = Session["name"]; updateadvisor update = new updateadvisor(); update.selectadvisor = getteachers(); update.selectSE = getSE(); update.selectTE = getTE(); update.selectBE = getBE(); return(View(update)); } }
public ActionResult updaterole(updateadvisor updatemodel, FormCollection formcollection) { using (var up = new AttendanceContext()) { var tid = new SqlParameter("@id", SqlDbType.Int) { Direction = System.Data.ParameterDirection.Input, Value = updatemodel.teacher }; var tid2 = new SqlParameter("@id2", SqlDbType.Int) { Direction = System.Data.ParameterDirection.Input, Value = updatemodel.teacher2 }; var tid3 = new SqlParameter("@id3", SqlDbType.Int) { Direction = System.Data.ParameterDirection.Input, Value = updatemodel.teacher3 }; var se = new SqlParameter("@se", SqlDbType.Int) { Direction = System.Data.ParameterDirection.Input, Value = updatemodel.SE }; var te = new SqlParameter("@te", SqlDbType.Int) { Direction = System.Data.ParameterDirection.Input, Value = updatemodel.TE }; var be = new SqlParameter("@be", SqlDbType.Int) { Direction = System.Data.ParameterDirection.Input, Value = updatemodel.BE }; var update = up.Database.SqlQuery <updateadvisor>("exec updaterole @id , @id2, @id3, @se, @te, @be", tid, tid2, tid3, se, te, be).ToList(); } TempData["updateclsadvmsg"] = "<script>alert('Class Advisor Updated Successfully');</script>"; return(RedirectToAction("admin", "admin")); }