//GET : /Teacher/Update/{id} public ActionResult Update(int id) { TeacherDataController controller = new TeacherDataController(); Teacher SelectedTeacher = controller.FindTeacher(id); return(View(SelectedTeacher)); }
public ActionResult Delete(int id) { TeacherDataController controller = new TeacherDataController(); controller.DeleteTeacher(id); return(RedirectToAction("List")); }
//GET : /Teacher/DeleteConfirm/{id} public ActionResult DeleteConfirm(int id) { TeacherDataController controller = new TeacherDataController(); Teacher NewTeacher = controller.FindTeacher(id); return(View(NewTeacher)); }
//GET : /Teacher/List public ActionResult List() { TeacherDataController controller = new TeacherDataController(); IEnumerable <Teacher> Teachers = controller.ListTeachers(); return(View(Teachers)); }
public ActionResult Update(int id, string TeacherFname, string TeacherLname, string EmployeeNumber) { Teacher TeacherInfo = new Teacher(); TeacherInfo.TeacherFname = TeacherFname; TeacherInfo.TeacherLname = TeacherLname; TeacherInfo.EmployeeNumber = EmployeeNumber; TeacherDataController controller = new TeacherDataController(); controller.UpdateTeacher(id, TeacherInfo); return(RedirectToAction("Show/" + id)); }
public ActionResult Create(string TeacherFname, string TeacherLname, string EmployeeNumber) { //Identifying is this method is running //Identifying the inputs provided from the form Debug.WriteLine("Created!"); Debug.WriteLine(TeacherFname); Debug.WriteLine(TeacherLname); Debug.WriteLine(EmployeeNumber); Teacher NewTeacher = new Teacher(); NewTeacher.TeacherFname = TeacherFname; NewTeacher.TeacherLname = TeacherLname; NewTeacher.EmployeeNumber = EmployeeNumber; // Accessing AddTeacher method in TeacherDataController TeacherDataController controller = new TeacherDataController(); controller.AddTeacher(NewTeacher); return(RedirectToAction("List")); }