Exemplo n.º 1
0
        public ActionResult Create(string TeacherFname, string TeacherLname, string TeacherEmployeeNumber, DateTime TeacherHireDate, decimal TeacherSalary)
        {
            /*// Identify the inputs and methods are running.
             *
             * Debug.WriteLine("I have access the create method!");
             * Debug.WriteLine(TeacherFname);
             * Debug.WriteLine(TeacherLname);
             * Debug.WriteLine(TeacherEmployeeNumber);
             * Debug.WriteLine(TeacherHireDate);
             * Debug.WriteLine(TeacherSalary);*/

            Teacher NewTeacher = new Teacher();

            NewTeacher.TeacherFirstName = TeacherFname;
            NewTeacher.TeacherLastName  = TeacherLname;
            NewTeacher.EmployeeNumber   = TeacherEmployeeNumber;
            NewTeacher.HireDate         = TeacherHireDate;
            NewTeacher.Salary           = TeacherSalary;

            TeacherDataController controller = new TeacherDataController();

            controller.AddTeacher(NewTeacher);

            return(RedirectToAction("List"));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Route to the view page based on the teacher id that is selected.
        /// </summary>
        /// <param name="id">Id of the Teacher</param>
        /// <returns>The information on the teacher base on the id.</returns>
        /// <example>GET: /Teacher/Update/1</example>
        public ActionResult Update(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher SelectedTeacher          = controller.FindTeacher(id);

            return(View(SelectedTeacher));
        }
Exemplo n.º 3
0
        public ActionResult Delete(int id)
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);
            return(RedirectToAction("List"));
        }
Exemplo n.º 4
0
        // GET: /Teacher/DeleteConfirm/{id}
        public ActionResult DeleteConfirm(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher NewTeacher = controller.FindTeacher(id);

            return(View(NewTeacher));
        }
Exemplo n.º 5
0
        // GET: Teacher/Show/{id}
        public ActionResult Show(int id)
        {
            // Call to TeacherDataController method FindTeachers, and pass information to the View(Show).
            TeacherDataController controller = new TeacherDataController();
            Teacher TeachersInfo             = controller.FindTeacher(id);

            return(View(TeachersInfo));
        }
Exemplo n.º 6
0
        // GET: Teacher/List
        public ActionResult List(string SearchKey = null)
        {
            // Call to TeacherDataController method ListTeachers, and pass information to the View(List).
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> Teachers   = controller.ListTeachers(SearchKey);

            return(View(Teachers));
        }
Exemplo n.º 7
0
        public ActionResult Update(int id, string TeacherFname, string TeacherLname, string TeacherEmployeeNumber, DateTime TeacherHireDate, decimal TeacherSalary)
        {
            Teacher TeacherInfo = new Teacher();

            TeacherInfo.TeacherFirstName = TeacherFname;
            TeacherInfo.TeacherLastName  = TeacherLname;
            TeacherInfo.EmployeeNumber   = TeacherEmployeeNumber;
            TeacherInfo.HireDate         = TeacherHireDate;
            TeacherInfo.Salary           = TeacherSalary;

            TeacherDataController controller = new TeacherDataController();

            controller.UpdateTeacher(id, TeacherInfo);

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