//GET: Teacher/DeleteConfirm/{id} public ActionResult DeleteConfirm(int id) {// get accesss from the Teachers dataController TeacherDataController controller = new TeacherDataController(); Teacher NewTeacher = controller.FindTeacher(id); return(View(NewTeacher)); }
//GET: Teacher/Delete/{id} public ActionResult Delete(int id) {// get accesss from the Teachers dataController TeacherDataController controller = new TeacherDataController(); controller.DeleteTeacher(id); return(RedirectToAction("List")); }
//GET: Teacher/List public ActionResult List(string Searchkey = null) { Debug.WriteLine("The Search key the is inputted is "); Debug.WriteLine(Searchkey); // get accesss from the Teachers dataController TeacherDataController controller = new TeacherDataController(); IEnumerable <Teacher> Teachers = controller.ListTeachers(Searchkey); return(View(Teachers)); }
public ActionResult Add(string TeacherFname, string TeacherLname, string EmployeeNumber, DateTime HireDate, decimal Salary) { //Indentify the inputs are provided from the form Teacher NewTeacher = new Teacher(); NewTeacher.TeacherFname = TeacherFname; NewTeacher.TeacherLname = TeacherLname; NewTeacher.EmployeeNumber = EmployeeNumber; NewTeacher.HireDate = HireDate; NewTeacher.Salary = Salary; TeacherDataController controller = new TeacherDataController(); controller.AddTeacher(NewTeacher); //redirected the user to the list page once the teacher is added to the database and the list is updated return(RedirectToAction("List")); }