コード例 #1
0
        public ActionResult Delete(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);
            return(RedirectToAction("List"));
        }
コード例 #2
0
        //GET : /Teacher/List
        public ActionResult List()
        {
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> Teachers   = controller.ListTeachers();

            return(View(Teachers));
        }
コード例 #3
0
        //GET : /Teacher/DeleteConfirm/{id}
        public ActionResult DeleteConfirm(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher NewTeacher = controller.FindTeacher(id);


            return(View(NewTeacher));
        }
コード例 #4
0
        //GET : /Teacher/Show/{id}
        public ActionResult Show(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher NewTeacher = controller.FindTeacher(id);

            Debug.WriteLine(NewTeacher);

            return(View(NewTeacher));
        }
コード例 #5
0
        public ActionResult Create(string TeacherFname, string TeacherLname, string EmployeeNumber, DateTime HireDate, double Salary)
        {
            //Identify the inputs provided from the form

            Debug.WriteLine("I have accessed the Create Method!");
            Debug.WriteLine(TeacherFname);
            Debug.WriteLine(TeacherLname);

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