// POST : /Teacher/Delete/{id}
        public ActionResult Delete(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);
            return(RedirectToAction("List"));
        }
        // GET : /Teacher/List
        public ActionResult List()
        {
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> Teachers   = controller.ListTeachers();

            return(View(Teachers));
        }
        // GET : /Teacher/Show
        public ActionResult Show(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            ViewBag.Teacher = controller.FindTeacher(id);
            ClassDataController ClassController = new ClassDataController();

            ViewBag.Class = ClassController.FindTeacherClass(id);
            return(View());
        }
Ejemplo n.º 4
0
        // GET: Class/Show/{int id}
        public ActionResult Show(int id)
        {
            ClassDataController controller = new ClassDataController();
            Class NewClass = controller.FindClass(id);

            ViewBag.Class = NewClass;
            TeacherDataController teachercontroller = new TeacherDataController();

            ViewBag.Teacher = teachercontroller.FindTeacher((int)NewClass.TeacherId);
            return(View());
        }
        // POST : /Teacher/Create
        public ActionResult Create(String TeacherFname, String TeacherLname, String EmployeeNumber, decimal Salary)
        {
            Teacher NewTeacher = new Teacher();

            NewTeacher.TeacherFname   = TeacherFname;
            NewTeacher.TeacherLname   = TeacherLname;
            NewTeacher.EmployeeNumber = EmployeeNumber;
            NewTeacher.Salary         = Salary;

            TeacherDataController controller = new TeacherDataController();

            controller.AddTeacher(NewTeacher);

            return(RedirectToAction("List"));
        }