예제 #1
0
        public ActionResult Create(string TeacherFname, string TeacherLname, string EmployeeNumber, DateTime HireDate, decimal Salary)
        {
            //Identify that this method is running and the inputs provided from the form
            Debug.WriteLine("I have accessed the Create Method!");
            Debug.WriteLine(TeacherFname);
            Debug.WriteLine(TeacherLname);
            Debug.WriteLine(EmployeeNumber);
            Debug.WriteLine(HireDate);
            Debug.WriteLine(Salary);


            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);

            return(RedirectToAction("List"));
        }
예제 #2
0
        public ActionResult Delete(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);
            return(RedirectToAction("List"));
        }
예제 #3
0
        //GET : /Teacher/Show/{id}
        // Acquire information about one particular teacher and send it to Show.cshtml
        public ActionResult Show(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher SelectedTeacher          = controller.FindTeacher(id);

            return(View(SelectedTeacher));
        }
예제 #4
0
        //GET : /Teacher/List
        // Acquire information about the teachers and send it to List.cshtml
        public ActionResult List()
        {
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> Teachers   = controller.ListTeachers();

            return(View(Teachers));
        }
예제 #5
0
        //GET : /Teacher/DeleteConfirm/{id}
        // Acquire information about one particular teacher and send it to DeleteConfirm.cshtml

        public ActionResult DeleteConfirm(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher NewTeacher = controller.FindTeacher(id);


            return(View(NewTeacher));
        }
예제 #6
0
        public ActionResult Update(int id, string TeacherFname, string TeacherLname, string EmployeeNumber, DateTime HireDate, decimal Salary)
        {
            Teacher TeacherInfo = new Teacher();

            TeacherInfo.TeacherFname   = TeacherFname;
            TeacherInfo.TeacherLname   = TeacherLname;
            TeacherInfo.EmployeeNumber = EmployeeNumber;
            TeacherInfo.HireDate       = HireDate;
            TeacherInfo.Salary         = Salary;

            TeacherDataController controller = new TeacherDataController();

            controller.UpdateTeacher(id, TeacherInfo);

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