/// <summary> /// Go to the dynamic page "Update Teacher" then gather info from the database /// </summary> /// <param name="id">Id of the teacher</param> /// <returns>provides the current information of the teacher and asks the user to alter the information as part of a form.</returns> /// <example>GET : /Teacher/Update/5</example> 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/List public ActionResult List(string SearchKey = null) { TeacherDataController controller = new TeacherDataController(); IEnumerable <Teacher> Teachers = controller.ListTeachers(SearchKey); return(View(Teachers)); }
//GET : /Teacher/DeleteConfirm/{id} public ActionResult DeleteConfirm(int id) { TeacherDataController controller = new TeacherDataController(); Teacher NewTeacher = controller.FindTeacher(id); return(View(NewTeacher)); }
public ActionResult Create(string TeacherFname, string TeacherLname, string EmployeeNumber, decimal Salary) { //Identify that this method is running //Identify the inputs provided from the form Teacher NewTeacher = new Teacher(); NewTeacher.TeacherFname = TeacherFname; NewTeacher.TeacherLname = TeacherLname; NewTeacher.EmployeeNumber = EmployeeNumber; NewTeacher.Salary = Salary; TeacherDataController controller = new TeacherDataController(); controller.AddTeacher(NewTeacher); return(RedirectToAction("List")); }
public ActionResult Update(int id, string TeacherFname, string TeacherLname, string EmployeeNumber, string HireDate, decimal Salary) { if (string.IsNullOrEmpty(TeacherFname)) { Debug.WriteLine("No no"); } Teacher TeacherInfo = new Teacher(); TeacherInfo.TeacherFname = TeacherFname; TeacherInfo.TeacherLname = TeacherLname; TeacherInfo.EmployeeNumber = EmployeeNumber; TeacherInfo.HireDate = Convert.ToDateTime(HireDate); TeacherInfo.Salary = Salary; TeacherDataController controller = new TeacherDataController(); controller.UpdateTeacher(id, TeacherInfo); return(RedirectToAction("Show/" + id)); }