Пример #1
0
        public ActionResult Create(string TeacherFname, string TeacherLname, string TeacherEnumber, DateTime TeacherHdate, decimal TeacherSalary)
        {
            //Identify that theis method is running
            //Indentify the inputs provided from teh form

            Debug.WriteLine("I have access to Create Method!");
            Debug.WriteLine(TeacherFname);
            Debug.WriteLine(TeacherLname);
            Debug.WriteLine(TeacherEnumber);


            Teacher NewTeacher = new Teacher();

            NewTeacher.TeacherFname   = TeacherFname;
            NewTeacher.TeacherLname   = TeacherLname;
            NewTeacher.TeacherEnumber = TeacherEnumber;
            NewTeacher.TeacherHdate   = TeacherHdate;
            NewTeacher.TeacherSalary  = TeacherSalary;


            TeacherDataController controller = new TeacherDataController();

            controller.AddTeacher(NewTeacher);
            return(RedirectToAction("List"));
        }
Пример #2
0
        //POST :/Teacher/Delete/{id}
        public ActionResult Delete(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);
            return(RedirectToAction("List"));
        }
Пример #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/Update/{id}
        ///
        public ActionResult Update(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher SelectedTeacher          = controller.FindTeacher(id);

            return(View(SelectedTeacher));
        }
Пример #5
0
        //We link TeacherController with list.cshtml page as TeacherController listens for a request
        //and links a specific page which we want to render.
        //GET: /Teacher/List

        public ActionResult List(string SearchKey = null)
        {
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> Teachers   = controller.ListTeachers(SearchKey);

            //We connect TeacherController to the actual Web.API Controller which accesses the data
            return(View(Teachers));
        }
Пример #6
0
        public ActionResult Update(int id, string TeacherFname, string
                                   TeacherLname, string TeacherEnumber, DateTime TeacherHdate,
                                   decimal TeacherSalary)

        {
            Teacher TeacherInfo = new Teacher();

            TeacherInfo.TeacherFname   = TeacherFname;
            TeacherInfo.TeacherLname   = TeacherLname;
            TeacherInfo.TeacherEnumber = TeacherEnumber;
            TeacherInfo.TeacherHdate   = TeacherHdate;
            TeacherInfo.TeacherSalary  = TeacherSalary;


            TeacherDataController controller = new TeacherDataController();

            controller.UpdateTeacher(id, TeacherInfo);

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