// GET: Classes/Show/{} // ActionResult function to display details about a particular class public ActionResult Show(int id) { ClassesDataController controller = new ClassesDataController(); Classes newClass = controller.FindClass(id); StuXCla filterClass = new StuXCla { class_id = id }; StudentXClassesDataController studentxclass_controller = new StudentXClassesDataController(); IEnumerable <StuXCla> listofStuXClass = studentxclass_controller.ListClassesOfStudent(filterClass); List <Student> listofStudentsTakingAClass = new List <Student> { }; StudentDataController student_controller = new StudentDataController(); string StringOfStudentIDs = ""; foreach (var StuXIns in listofStuXClass) { StringOfStudentIDs += StuXIns.student_id + ","; } IEnumerable <Student> ListOfStudentsInAClass = student_controller.FilterStudents(null, null, null, null, StringOfStudentIDs); ClassAndTheirStudents studentclass = new ClassAndTheirStudents { classes = newClass, students = ListOfStudentsInAClass }; return(View(studentclass)); }
// POST: Student/Filter/{} public ActionResult Filter(string name = null, string enrolDateLow = null, string enrolDateHigh = null, string studentInpNumber = null) { StudentDataController controller = new StudentDataController(); IEnumerable <Student> filterStudents = controller.FilterStudents(name, enrolDateLow, enrolDateHigh, studentInpNumber); return(View(filterStudents)); }