Example #1
0
        public ActionResult GetShow(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher teacher = controller.FindTeacher(id);

            return(View(teacher));
        }
Example #2
0
        public ActionResult Delete(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);
            return(RedirectToAction("List"));
        }
Example #3
0
        public ActionResult List()
        {
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> teachers   = controller.ListTeachers();

            return(View(teachers));
        }
Example #4
0
        public ActionResult DeleteConfirm(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher teacher = controller.FindTeacher(id);


            return(View(teacher));
        }
Example #5
0
        public ActionResult Update(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            Teacher selectedTeacher = controller.FindTeacher(id);

            return(View(selectedTeacher));
        }
Example #6
0
        public ActionResult Create(string fname, string lname, DateTime date, decimal salary)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher teacher = new Teacher();

            teacher.teacherFname = fname;
            teacher.teacherLname = lname;
            teacher.hireDate     = Convert.ToDateTime(date);
            teacher.salary       = Convert.ToDecimal(salary);

            controller.AddTeacher(teacher);
            return(RedirectToAction("List"));
        }
Example #7
0
        public ActionResult Update(int id, string fname, string lname, decimal salary)
        {
            Teacher teacher = new Teacher();

            teacher.teacherId    = id;
            teacher.teacherFname = fname;
            teacher.teacherLname = lname;

            teacher.salary = salary;

            TeacherDataController controller = new TeacherDataController();

            controller.updateTeacher(teacher);

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