public ActionResult Delete(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);
            return(RedirectToAction("List"));
        }
        //GET : /Teacher/List
        /// <summary>
        /// To contect the teacher datacontroller list method  with the  list view
        /// </summary>
        /// <param name="SearchKey"></param>
        /// <returns></returns>
        public ActionResult List(string SearchKey = null)
        {
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> Teachers   = controller.ListTeachers(SearchKey);

            return(View(Teachers));
        }
        public ActionResult Ajax_Update(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher SelectedTeacher          = controller.FindTeacher(id);

            return(View(SelectedTeacher));
        }
        /// <summary>
        /// To the users if they want to confirm the delete of a particular teacher so the delete was not a mistake
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        //GET : /Teacher/DeleteConfirm/{id}
        public ActionResult DeleteConfirm(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher NewTeacher = controller.FindTeacher(id);


            return(View(NewTeacher));
        }
        public ActionResult Update(int id, string TeacherFname, string TeacherLname, string TeacherEmployeeNum, decimal TeacherSalary)
        {
            Teacher TeacherInfo = new Teacher();

            TeacherInfo.TeacherFname       = TeacherFname;
            TeacherInfo.TeacherLname       = TeacherLname;
            TeacherInfo.TeacherEmployeeNum = TeacherEmployeeNum;
            TeacherInfo.TeacherSalary      = TeacherSalary;

            TeacherDataController controller = new TeacherDataController();

            controller.UpdateTeacher(id, TeacherInfo);

            return(RedirectToAction("Show/" + id));
        }
        public ActionResult Create(string TeacherFname, string TeacherLname, string TeacherEmployeeNum, decimal TeacherSalary)
        {
            //To check whether we get the data from the form

            Debug.WriteLine("I have accessed the data:");
            Debug.WriteLine(TeacherFname);
            Debug.WriteLine(TeacherLname);
            Debug.WriteLine(TeacherEmployeeNum);
            Debug.WriteLine(TeacherSalary);

            Teacher NewTeacher = new Teacher();

            NewTeacher.TeacherFname       = TeacherFname;
            NewTeacher.TeacherLname       = TeacherLname;
            NewTeacher.TeacherEmployeeNum = TeacherEmployeeNum;
            NewTeacher.TeacherSalary      = TeacherSalary;

            TeacherDataController controller = new TeacherDataController();

            controller.AddTeacher(NewTeacher);

            return(RedirectToAction("List"));
        }