public ActionResult Delete(int id) { StudentDataController controller = new StudentDataController(); controller.DeleteStudent(id); return(RedirectToAction("List")); }
public ActionResult Create(string StudentFname, string StudentLname, string StudentNumber, String EnrolDate) { /*// Identify the inputs and methods are running. * * Debug.WriteLine("I have access the create method!"); * Debug.WriteLine(StudentFname); * Debug.WriteLine(StudentLname); * Debug.WriteLine(StudentNumber); * // Debug.WriteLine(EnrolDate.Date); * // DateTime EnrolDate * // When being passed in the parameters it expects only a Date but DateTime is the only data type*/ // How do I grab only the date from DateTime from paremeter input? Student NewStudent = new Student(); NewStudent.StudentFName = StudentFname; NewStudent.StudentLName = StudentLname; NewStudent.StudentNumber = StudentNumber; NewStudent.EnrolDate = Convert.ToDateTime(EnrolDate); // This is to allow a null value to pass through. StudentDataController controller = new StudentDataController(); controller.AddStudent(NewStudent); return(RedirectToAction("List")); }
// GET: /Student/DeleteConfirm/{id} public ActionResult DeleteConfirm(int id) { StudentDataController controller = new StudentDataController(); Student NewStudent = controller.FindStudent(id); return(View(NewStudent)); }
/// <summary> /// Route to the view page based on the student id that is selected. /// </summary> /// <param name="id">Id of the Student</param> /// <returns>The information on the student base on the id.</returns> /// <example>GET: /Student/Update/1</example> public ActionResult Update(int id) { StudentDataController controller = new StudentDataController(); Student SelectedStudent = controller.FindStudent(id); return(View(SelectedStudent)); }
// GET: Student/Show{id} public ActionResult Show(int id) { // Call to StudentDataController method FindStudent(id), and pass information to the View(Show). StudentDataController controller = new StudentDataController(); Student NewStudent = controller.FindStudent(id); return(View(NewStudent)); }
// GET: Student/List/{SearchKey} public ActionResult List(string SearchKey = null) { // Call to StudentDataController method ListStudent(SearchKey), and pass information to the View(List). StudentDataController controller = new StudentDataController(); IEnumerable <Student> Students = controller.ListStudents(SearchKey); return(View(Students)); }
public ActionResult Update(int id, string StudentFname, string StudentLname, string StudentNumber, DateTime EnrolDate) { Student StudentInfo = new Student(); StudentInfo.StudentFName = StudentFname; StudentInfo.StudentLName = StudentLname; StudentInfo.StudentNumber = StudentNumber; StudentInfo.EnrolDate = EnrolDate.Date; // Only Grab the date from DateTime StudentDataController controller = new StudentDataController(); controller.UpdateStudent(id, StudentInfo); return(RedirectToAction("Show/" + id)); }