Exemple #1
0
        public ActionResult Ajax_Update(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher SelectedTeacher          = controller.FindTeacher(id);

            return(View(SelectedTeacher));
        }
Exemple #2
0
        public ActionResult Delete(int id)
        ///refering the action to list of teachers
        {
            TeacherDataController controller = new TeacherDataController();

            controller.DeleteTeacher(id);
            return(RedirectToAction("List"));
        }
Exemple #3
0
        //GET : /Teacher/DeleteCofirm/{id}
        //Creating a method to allow us to delete a record,
        // we are still finding and displaying teacher in our actual view
        public ActionResult DeleteConfirm(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher NewTeacher = controller.FindTeacher(id);


            return(View(NewTeacher));
        }
Exemple #4
0
        //GET : /Teacher/List
        //GET : /Api/TeacherData/ListTeachers/{SearchKey}


        public ActionResult List(String SearchKey = null)
        {
            Debug.WriteLine("The inputted search key is");
            Debug.WriteLine(SearchKey);
            //connecting teacher contrller to the web api controller which access the data.
            TeacherDataController controller = new TeacherDataController();
            IEnumerable <Teacher> Teachers   = controller.ListTeachers(SearchKey);

            return(View(Teachers));
        }
Exemple #5
0
        //GET : /Teacher/Show/{id}
        //here we are linking another dynamic rendered page to the controller
        public ActionResult Show(int id)
        {
            TeacherDataController controller = new TeacherDataController();
            Teacher SelectedTeacher          = controller.FindTeacher(id);

            if (SelectedTeacher != null)
            {
                ClassDataController classDataController  = new ClassDataController();
                IEnumerable <Class> listOfTeacherClasses = classDataController.ListTeachersClasses(id);

                SelectedTeacher.ListOfClasses = listOfTeacherClasses;
            }

            return(View(SelectedTeacher));
        }
Exemple #6
0
        public ActionResult Update(int id, string TeacherFname, string TeacherLname, decimal Salary)
        {
            Teacher TeacherInfo = new Teacher();

            TeacherInfo.TeacherFname = TeacherFname;
            TeacherInfo.TeacherLname = TeacherLname;
            TeacherInfo.Salary       = Salary;


            TeacherDataController controller = new TeacherDataController();

            controller.UpdateTeacher(id, TeacherInfo);

            return(RedirectToAction("Show/" + id));
        }
Exemple #7
0
        public ActionResult Create(string TeacherFname, string TeacherLname, decimal Salary)
        {
            //we need to validate that the Create method is working  and receiving the inputs from the form

            Debug.WriteLine("Create Method is working");
            Debug.WriteLine(TeacherFname);
            Debug.WriteLine(TeacherLname);
            Debug.WriteLine(Salary);

            Teacher NewTeacher = new Teacher();

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

            TeacherDataController controller = new TeacherDataController();

            controller.AddTeacher(NewTeacher);

            return(RedirectToAction("List"));
        }