Exemplo n.º 1
0
        //GET : /Teacher/Update/{id}
        public ActionResult Update(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher SelectedTeacher          = controller.FindTeacher(id);

            return(View(SelectedTeacher));
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);
            return(RedirectToAction("List"));
        }
Exemplo n.º 3
0
        //GET : /Teacher/DeleteConfirm/{id}
        public ActionResult DeleteConfirm(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher NewTeacher = controller.FindTeacher(id);

            return(View(NewTeacher));
        }
Exemplo n.º 4
0
        //GET : /Teacher/List
        public ActionResult List()
        {
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> Teachers   = controller.ListTeachers();

            return(View(Teachers));
        }
Exemplo n.º 5
0
        public ActionResult Update(int id, string TeacherFname, string TeacherLname, string EmployeeNumber)
        {
            Teacher TeacherInfo = new Teacher();

            TeacherInfo.TeacherFname   = TeacherFname;
            TeacherInfo.TeacherLname   = TeacherLname;
            TeacherInfo.EmployeeNumber = EmployeeNumber;

            TeacherDataController controller = new TeacherDataController();

            controller.UpdateTeacher(id, TeacherInfo);

            return(RedirectToAction("Show/" + id));
        }
Exemplo n.º 6
0
        public ActionResult Create(string TeacherFname, string TeacherLname, string EmployeeNumber)
        {
            //Identifying is this method is running
            //Identifying the inputs provided from the form
            Debug.WriteLine("Created!");
            Debug.WriteLine(TeacherFname);
            Debug.WriteLine(TeacherLname);
            Debug.WriteLine(EmployeeNumber);

            Teacher NewTeacher = new Teacher();

            NewTeacher.TeacherFname   = TeacherFname;
            NewTeacher.TeacherLname   = TeacherLname;
            NewTeacher.EmployeeNumber = EmployeeNumber;

            // Accessing AddTeacher method in TeacherDataController
            TeacherDataController controller = new TeacherDataController();

            controller.AddTeacher(NewTeacher);

            return(RedirectToAction("List"));
        }