Exemplo n.º 1
0
        //GET: Student/DeleteConfirm/{id}
        public ActionResult DeleteConfirm(int id)
        {
            StudentDataController controller = new StudentDataController();
            Student NewStudent = controller.FindStudent(id);

            return(View(NewStudent));
        }
Exemplo n.º 2
0
        //GET : /Student/Update/{id}
        /// <summary>
        /// sends a get request to display the information of the student
        /// </summary>
        /// <param name="id">student Id</param>
        /// <returns></returns>
        public ActionResult Update(int id)
        {
            // get accesss from the Student dataController
            StudentDataController controller = new StudentDataController();
            Student SelectedStudent          = controller.FindStudent(id);

            return(View(SelectedStudent));
        }
Exemplo n.º 3
0
        //GET: Student/Delete/{id}
        public ActionResult Delete(int id)
        {
            StudentDataController controller = new StudentDataController();

            controller.DeleteStudent(id);

            return(RedirectToAction("List"));
        }
Exemplo n.º 4
0
        //GET: Student/List
        public ActionResult List(string Searchkey = null)
        {
            Debug.WriteLine("The Search key the is inputted is ");
            Debug.WriteLine(Searchkey);
            // get accesss from the Students dataController
            StudentDataController controller = new StudentDataController();
            IEnumerable <Student> Students   = controller.ListStudents(Searchkey);

            return(View(Students));
        }
Exemplo n.º 5
0
        //POST : /Student/Update/{id}
        /// <summary>
        /// Receiving a POST request from the webserver to the database wuth information of the existing student ,updating the values.
        /// It sends the inofrmation to the API and then redirects it to the "Student/Show page of the updated teacher
        /// </summary>
        /// <param name="id"> Id of the student to update</param>
        /// <param name="StudentFname"> Updated student first namer</param>
        /// <param name="StudentLname">Updated student last name</param>
        /// <param name="StudentNumber">Updated student  number</param>
        /// <param name="EnrolDate">Updated student Hiring Date</param>

        /// <returns>dynamic updated webpage of the existing student</returns>
        /// <example>POST: /Student/Update/20
        ///
        /// FORM DATA/ POST DATA/ REQUEST BODY
        /// {
        /// "StudentFname":"Jon",
        /// "StudentLname": "Don",
        /// "StudentNumber": "N6666",
        /// "EnrolDate":"2018-04-02"
        /// }
        /// </example>
        public ActionResult Update(int id, string StudentFname, string StudentLname, string StudentNumber, DateTime EnrolDate)
        {
            //Indentify the inputs are provided from the form
            Student StudentInfo = new Student();

            StudentInfo.StudentFname  = StudentFname;
            StudentInfo.StudentLname  = StudentLname;
            StudentInfo.StudentNumber = StudentNumber;
            StudentInfo.EnrolDate     = EnrolDate;
            StudentDataController controller = new StudentDataController();

            controller.UpdateStudent(id, StudentInfo);
            return(RedirectToAction("Show/" + id));
        }
Exemplo n.º 6
0
        public ActionResult Add(string StudentFname, string StudentLname, string StudentNumber, DateTime EnrolDate)
        {
            //Indentify the inputs are proivded from the form
            Student NewStudent = new Student();

            NewStudent.StudentFname  = StudentFname;
            NewStudent.StudentLname  = StudentLname;
            NewStudent.StudentNumber = StudentNumber;
            NewStudent.EnrolDate     = EnrolDate;

            StudentDataController controller = new StudentDataController();

            controller.AddStudent(NewStudent);

            return(RedirectToAction("List"));
        }