コード例 #1
0
        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
        }
コード例 #2
0
        // GET: Students
        public ActionResult Index()
        {
            var adminRole = new AdminRole();

            return(View(adminRole.GetStudents()));
        }