public ActionResult Edit([Bind(Include = "ClassesId,ClassName")] Classes model) { if (!LoginStatus()) { return(RedirectToAction("Login", "Admins", null)); } bool Exists = _db.Classess.Any(d => d.ClassName.Equals(model.ClassName)); if (!Exists) { if (ModelState.IsValid) { _db.Entry(model).State = EntityState.Modified; _db.SaveChanges(); return(Json("")); } else { return(Json("Model is not valid.")); } } else { return(Json("Try another label name")); } }
public ActionResult Edit([Bind(Include = "EduYearId,EduYearName,EduStart,EduEnd")] EduYear model) { if (!LoginStatus()) { return(RedirectToAction("Login", "Admins", null)); } if (model.EduStart >= model.EduEnd) { return(Json("start date should be before end date")); } bool Exists = _db.EduYears.Any(d => d.EduYearName.Equals(model.EduYearName)); if (!Exists) { if (ModelState.IsValid) { _db.Entry(model).State = EntityState.Modified; _db.SaveChanges(); return(Json("")); } else { return(Json("Model is not valid.")); } } else { return(Json("Try another label name")); } }
public ActionResult Edit([Bind(Include = "TeacherId,FullName,LoginName,Password,Types,EduYearId")] Teacher model) { if (!LoginStatus()) { return(RedirectToAction("Login", "Admins", null)); } if (ModelState.IsValid) { model.EduYear = _db.EduYears.Find((int)GetEduYearId); model.EduYearId = (int)GetEduYearId; _db.Entry(model).State = EntityState.Modified; _db.SaveChanges(); return(Json("")); } return(View(model)); }
public ActionResult Edit([Bind(Include = "ExamId,ExamName,EduYearId")] Exam model) { if (!LoginStatus()) { return(RedirectToAction("Login", "Admins", null)); } if (ModelState.IsValid) { model.EduYear = _db.EduYears.Find(model.EduYearId); model.EduYearId = model.EduYearId; _db.Entry(model).State = EntityState.Modified; _db.SaveChanges(); return(Json("")); } else { return(Json("Model is not valid.")); } }
public ActionResult AdEdit([Bind(Include = "AdminId,Name,Password,Types")] Admin model) { if (!LoginStatus()) { return(RedirectToAction("Login", "Admins", null)); } if (adminType != 0) { return(RedirectToAction("AdIndex", "Admins", null)); } if (ModelState.IsValid) { _db.Entry(model).State = EntityState.Modified; _db.SaveChanges(); return(Json("")); } return(View(model)); }