public ActionResult Update(int Id) { TeacherDataController controller = new TeacherDataController(); Teacher TeacherInfo = controller.FindTeacher(Id); return(View(TeacherInfo)); }
//POST :/Teacher/Delete/{id} 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)); }
/// <summary> /// An action which allows you to route Teachers data fetched from the database /// to dynamic web pages /// </summary> /// <returns> /// A list of Teachers /// </returns> //GET : /Teacher/List/{} public ActionResult List(string SearchKey = null) { TeacherDataController controller = new TeacherDataController(); IEnumerable <Teacher> Teachers = controller.ListTeachers(SearchKey); return(View(Teachers)); }
public ActionResult Create(string TeacherFname, string TeacherLname, string EmployeeNumber, double Salary) { Teacher NewTeacher = new Teacher(); NewTeacher.TeacherFname = TeacherFname; NewTeacher.TeacherLname = TeacherLname; NewTeacher.EmployeeNumber = EmployeeNumber; NewTeacher.Salary = Salary; NewTeacher.HireDate = DateTime.Today; TeacherDataController controller = new TeacherDataController(); controller.CreateTeacher(NewTeacher); return(RedirectToAction("List")); }
public ActionResult Update(int Id, string TeacherFname, string TeacherLname, string EmployeeNumber, double Salary) { Teacher UpdatedTeacherInfo = new Teacher(); UpdatedTeacherInfo.TeacherFname = TeacherFname; UpdatedTeacherInfo.TeacherLname = TeacherLname; UpdatedTeacherInfo.EmployeeNumber = EmployeeNumber; UpdatedTeacherInfo.Salary = Salary; TeacherDataController controller = new TeacherDataController(); controller.UpdateTeacher(Id, UpdatedTeacherInfo); return(RedirectToAction("Show/" + Id)); }