//GET /Student/Update/
        public ActionResult Update(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            Teacher SelectedTeacher = controller.FindTeacher(id);

            return(View(SelectedTeacher));
        }
        public ActionResult DeleteConfirm(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            Teacher NewTeacher = controller.FindTeacher(id);

            return(View(NewTeacher));
        }
        public ActionResult Delete(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);

            return(RedirectToAction("List"));
        }
        //GET: /Teacher/Show/{id}
        public ActionResult Show(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            Teacher newTeacher = controller.FindTeacher(id);

            return(View(newTeacher));
        }
        // GET: /Teachers/List
        public ActionResult List(string SearchKey = null)
        {
            //debug comments for searching the teacher table
            Debug.WriteLine("The input search key is ");
            Debug.WriteLine(SearchKey);


            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> Teachers   = controller.ListTeachers(SearchKey);

            return(View(Teachers));
        }
        public ActionResult Create(string TeacherFname, string TeacherLname, string EmployeeNum, int Salary)
        {
            Teacher newTeacher = new Teacher();

            newTeacher.TeacherFname = TeacherFname;
            newTeacher.TeacherLname = TeacherLname;
            newTeacher.EmployeeNum  = EmployeeNum;
            newTeacher.Salary       = Salary;

            TeacherDataController controller = new TeacherDataController();

            controller.AddTeacher(newTeacher);

            return(RedirectToAction("List"));
        }
        public ActionResult Update(int id, string TeacherFname, string TeacherLname, string EmployeeNum, decimal Salary)
        {
            Debug.WriteLine("The updated info received is " + TeacherFname + " " + TeacherLname + " " + EmployeeNum);

            Teacher TeacherInfo = new Teacher();

            TeacherInfo.TeacherId    = id;
            TeacherInfo.TeacherFname = TeacherFname;
            TeacherInfo.TeacherLname = TeacherLname;
            TeacherInfo.EmployeeNum  = EmployeeNum;
            TeacherInfo.Salary       = Salary;

            TeacherDataController controller = new TeacherDataController();

            controller.UpdateTeacher(TeacherInfo);

            return(RedirectToAction("Show/" + id));
        }