Esempio n. 1
0
        public ActionResult Delete(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);
            return(RedirectToAction("List"));
        }
Esempio n. 2
0
        /// <summary>
        /// assigned a class to a teacher in the database
        /// </summary>
        /// <param name="id"> id of the teacher</param>
        /// <returns> dynamic webpage which allows to assigned a class to a teacher</returns>
        /// <example>GET: /Teacher/AddTeacherClass/5</example>
        public ActionResult AddTeacherClass(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher teacher = controller.GetTeacherById(id);

            return(View(teacher));
        }
Esempio n. 3
0
        public ActionResult List()
        {
            //we will to gather the list of teachers
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> teachers   = controller.ListTeachers();

            return(View(teachers));
        }
Esempio n. 4
0
        public ActionResult Show(int?id)
        {
            //we will to gather the list of teachers
            TeacherDataController teacherController = new TeacherDataController();
            Teacher teacher = teacherController.GetTeacherById(id);
            // gather teacher classes
            ClassDataController classesController = new ClassDataController();

            teacher.classes = classesController.ListTeachersClasses(id);

            return(View(teacher));;
        }
Esempio n. 5
0
        /// <summary>
        /// Routes to a dynamically generated "teacher Update" Page. Gathers information from the database.
        /// </summary>
        /// <param name="id">Id of the teacher</param>
        /// <returns>A dynamic "Update teacher" webpage which provides the current information of the teacher and asks the user for new information as part of a form.</returns>
        /// <example>GET : /Teacher/Update/5</example>

        public ActionResult Update(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher teacher = controller.GetTeacherById(id);

            System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
            customCulture.NumberFormat.NumberDecimalSeparator    = ".";
            System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

            teacher.salary = decimal.Parse(teacher.salary.ToString());

            return(View(teacher));
        }
Esempio n. 6
0
        public ActionResult Create(string TeacherFname, string TeacherLname, string TeacherNumber, string TeacherSalary)
        {
            Teacher newTeacher = new Teacher();

            newTeacher.firstname      = TeacherFname;
            newTeacher.lastname       = TeacherLname;
            newTeacher.employeeNumber = TeacherNumber;
            newTeacher.salary         = decimal.Parse(TeacherSalary, new System.Globalization.CultureInfo("en-US"));

            TeacherDataController controller = new TeacherDataController();

            controller.AddTeacher(newTeacher);

            return(RedirectToAction("List"));
        }