public ActionResult Edit(subject subjectToEdit) { var originalSubject = (from m in _db.subjects where m.sub_id == subjectToEdit.sub_id select m).First(); if (!ModelState.IsValid) return View(originalSubject); _db.Entry(originalSubject).CurrentValues.SetValues(subjectToEdit); _db.SaveChanges(); return RedirectToAction("SubjectView"); }
public ActionResult Edit(teacher teacherToEdit) { try { var originalTeacher = (from m in _db.teachers where m.t_id == teacherToEdit.t_id select m).First(); if (!ModelState.IsValid) { return(View(originalTeacher)); } _db.Entry(originalTeacher).CurrentValues.SetValues(teacherToEdit); _db.SaveChanges(); return(RedirectToAction("TeacherView")); } catch { return(View()); } }
public ActionResult Edit(classroom classroomToEdit) { var originalclassroom = (from c in _db.classrooms where c.class_id == classroomToEdit.class_id select c).First(); if (!ModelState.IsValid) { return(View(originalclassroom)); } _db.Entry(originalclassroom).CurrentValues.SetValues(classroomToEdit); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(Tutes tuteToEdit) { var originalTute = (from m in _db.Tutes1 where m.Tute_id == tuteToEdit.Tute_id select m).First(); if (!ModelState.IsValid) { return(View(originalTute)); } _db.Entry(originalTute).CurrentValues.SetValues(tuteToEdit); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(exam examToEdit) { var originalExam = (from m in _db.exams where m.exam_id == examToEdit.exam_id select m).First(); if (!ModelState.IsValid) { return(View(originalExam)); } _db.Entry(originalExam).CurrentValues.SetValues(examToEdit); _db.SaveChanges(); return(RedirectToAction("Exams")); }
public ActionResult Edit(Student studentToEdit) { var originalStudent = (from m in _db.Students where m.Id == studentToEdit.Id select m).First(); if (!ModelState.IsValid) { return(View(originalStudent)); } _db.Entry(originalStudent).CurrentValues.SetValues(studentToEdit); _db.SaveChanges(); return(RedirectToAction("StudentView")); }
public ActionResult Edit(Allocation allocationToEdit) { var originalAllocation = (from c in _db.Allocations where c.ca_id == allocationToEdit.ca_id select c).First(); if (!ModelState.IsValid) { return(View(originalAllocation)); } _db.Entry(originalAllocation).CurrentValues.SetValues(allocationToEdit); _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult EditBill(Bill billToEdit) { var originalBill = (from m in _db.Bills where m.billId == billToEdit.billId select m).First(); if (!ModelState.IsValid) { return(View(originalBill)); } _db.Entry(originalBill).CurrentValues.SetValues(billToEdit); _db.SaveChanges(); return(RedirectToAction("Bill")); }
public ActionResult Edit(employee employeeToEdit) { try { var originalEmployee = (from m in _db.employees where m.emp_id == employeeToEdit.emp_id select m).First(); if (!ModelState.IsValid) { return(View(originalEmployee)); } _db.Entry(originalEmployee).CurrentValues.SetValues(employeeToEdit); _db.SaveChanges(); return(RedirectToAction("EmployeeView")); } catch { return(View()); } }
public ActionResult Edit(notify notifyToEdit) { try { var originalNotify = (from m in _db.notifies where m.n_id == notifyToEdit.n_id select m).First(); if (!ModelState.IsValid) { return(View(originalNotify)); } _db.Entry(originalNotify).CurrentValues.SetValues(notifyToEdit); _db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }