Example #1
0
        public LmsViewModel(int userId, bool isLector)
        {
            Subjects        = SubjectManagementService.GetUserSubjects(userId).Where(e => !e.IsArchive).Select(e => new SubjectViewModel(e)).ToList();
            CurrentSubjects = Subjects.Count();
            TotalSubject    = SubjectManagementService.GetSubjects().Count();

            var modelStudents = new List <int>();

            CurrentStudents = 0;

            if (isLector)
            {
                TotalStudents = StudentManagementService.GetStudents().Count();

                foreach (var subjects in SubjectManagementService.GetUserSubjects(userId))
                {
                    if (subjects.SubjectGroups != null)
                    {
                        foreach (var group in subjects.SubjectGroups)
                        {
                            foreach (var student in group.SubjectStudents)
                            {
                                if (modelStudents.All(e => e != student.StudentId))
                                {
                                    modelStudents.Add(student.StudentId);
                                    CurrentStudents += 1;
                                }
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        public LmsViewModel(int userId, bool isLector)
        {
            var s = SubjectManagementService.GetUserSubjects(userId).Where(e => !e.IsArchive);

            Subjects        = s.Select(e => new SubjectViewModel(e)).ToList();
            CurrentSubjects = Subjects.Count();
            TotalSubject    = SubjectManagementService.GetSubjects().Count();
            ComplexSubjects = s
                              .Where(cs =>
                                     ModulesManagementService.GetModules(cs.Id).Any(m => m.ModuleType == ModuleType.ComplexMaterial))
                              .Select(e => new SubjectViewModel(e)).ToList();
            CourseProjectSubjects = s.Where(cs =>
                                            ModulesManagementService.GetModules(cs.Id).Any(m => m.ModuleType == ModuleType.YeManagment))
                                    .Select(e => new SubjectViewModel(e)).ToList();

            var modelStudents = new List <int>();

            CurrentStudents = 0;

            if (isLector)
            {
                TotalStudents = StudentManagementService.GetStudents().Count();

                foreach (var subjects in SubjectManagementService.GetUserSubjects(userId))
                {
                    if (subjects.SubjectGroups != null)
                    {
                        foreach (var group in subjects.SubjectGroups)
                        {
                            foreach (var student in group.SubjectStudents)
                            {
                                if (modelStudents.All(e => e != student.StudentId))
                                {
                                    modelStudents.Add(student.StudentId);
                                    CurrentStudents += 1;
                                }
                            }
                        }
                    }
                }
            }
        }