示例#1
0
        public ActionResult Update(int Id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher TeacherInfo = controller.FindTeacher(Id);

            return(View(TeacherInfo));
        }
示例#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
        /// <summary>
        /// An action which allows you to route Teachers data fetched from the database
        /// to dynamic web pages
        /// </summary>
        /// <returns>
        /// A list of Teachers
        /// </returns>
        //GET : /Teacher/List/{}
        public ActionResult List(string SearchKey = null)
        {
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> Teachers   = controller.ListTeachers(SearchKey);

            return(View(Teachers));
        }
示例#5
0
        public ActionResult Create(string TeacherFname, string TeacherLname, string EmployeeNumber, double Salary)
        {
            Teacher NewTeacher = new Teacher();

            NewTeacher.TeacherFname   = TeacherFname;
            NewTeacher.TeacherLname   = TeacherLname;
            NewTeacher.EmployeeNumber = EmployeeNumber;
            NewTeacher.Salary         = Salary;
            NewTeacher.HireDate       = DateTime.Today;
            TeacherDataController controller = new TeacherDataController();

            controller.CreateTeacher(NewTeacher);
            return(RedirectToAction("List"));
        }
示例#6
0
        public ActionResult Update(int Id, string TeacherFname, string TeacherLname, string EmployeeNumber, double Salary)
        {
            Teacher UpdatedTeacherInfo = new Teacher();

            UpdatedTeacherInfo.TeacherFname   = TeacherFname;
            UpdatedTeacherInfo.TeacherLname   = TeacherLname;
            UpdatedTeacherInfo.EmployeeNumber = EmployeeNumber;
            UpdatedTeacherInfo.Salary         = Salary;

            TeacherDataController controller = new TeacherDataController();

            controller.UpdateTeacher(Id, UpdatedTeacherInfo);
            return(RedirectToAction("Show/" + Id));
        }