public ActionResult DeleteOne(int studentId) { Student thisStudent = Student.Find(studentId); thisStudent.DeleteOne(); return(RedirectToAction("StudentIndex")); }
public ActionResult Update(int id) { string newName = Request.Form["newname"]; Student thisStudent = Student.Find(id); thisStudent.UpdateName(newName); return(RedirectToAction("StudentIndex")); }
public ActionResult AddCourse(int studentId) { Student student = Student.Find(studentId); Course course = Course.Find(Int32.Parse(Request.Form["course-id"])); student.AddCourse(course); return(View("Success")); }
public ActionResult AddStudent(int courseId) { Course course = Course.Find(courseId); Student student = Student.Find(Int32.Parse(Request.Form["student-id"])); course.AddStudent(student); return(RedirectToAction("Success", "Home")); }
public void Test_Find_FindStudentInDatabase() { //Arrange Student testStudent = new Student("Jasper", "07/24/2017"); testStudent.Save(); //Act Student foundStudent = Student.Find(testStudent.GetId()); //Assert Assert.Equal(testStudent, foundStudent); }
public void Test_FindFindsStudentInDatabase() { //Arrange Student testStudent = new Student("Steve"); testStudent.Save(); //Act Student result = Student.Find(testStudent.GetId()); //Assert Assert.Equal(testStudent, result); }
public ActionResult StudentDetail(int id) { Dictionary <string, object> model = new Dictionary <string, object>(); Student selectedStudent = Student.Find(id); List <Course> studentCourses = selectedStudent.GetCourses(); List <Course> allCourses = Course.GetAll(); model.Add("student", selectedStudent); model.Add("studentCourses", studentCourses); model.Add("allCourses", allCourses); return(View("StudentDetails", model)); }
public ActionResult StudentUpdateForm(int id) { Student thisStudent = Student.Find(id); return(View("StudentUpdate", thisStudent)); }