Example #1
0
        //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));
        }
Example #2
0
        //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"));
        }
Example #3
0
        //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));
        }
Example #4
0
        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"));
        }