public ActionResult ListStudent(int ClassId) { var adminRole = new AdminRole(); // var students = adminRole.GetStudents().Except(adminRole.GetStudentsOfClass(ClassId)).ToList(); var students = adminRole.GetStudents().Select(x => new StudentSubscriptionVM { StudentId = x.StudentId, Name = $"{x.StudentName}, {x.StudentFirstName}", Subscribed = false }).ToList(); var studentsSubscribed = adminRole.GetStudentsOfClass(ClassId).ToList(); students.ForEach(x => x.Subscribed = studentsSubscribed.Any(y => y.StudentId == x.StudentId)); var ViewValue = new ClassWithStudentsVM { Classe = adminRole.GetClass(ClassId), Students = students }; return(View(ViewValue));//ajouter page de selection }
// GET: Students public ActionResult Index() { var adminRole = new AdminRole(); return(View(adminRole.GetStudents())); }