public async Task OnGetAsync() { //get list of Students StudentList = await _db.Students.AsNoTracking().ToListAsync(); ProgrammesList = await _db.Programmes.AsNoTracking().ToListAsync(); if (!String.IsNullOrEmpty(ProgrammeSearchString)) { ProgrammesFound = ProgrammesList.Where(s => s.ProgrammeName.Contains(ProgrammeSearchString)) .Select(s => s) .ToList(); } if ((ProgrammesFound != null) && (ProgrammesFound.Count() != 0)) { foreach (var programme in ProgrammesFound) { var students = StudentList.Where(s => s.ProgrammeID == programme.ProgrammeID) .Select(s => s); foreach (var student in students) { SelectedStudentList.Add(student); } } } else { SelectedStudentList = StudentList.ToList(); } }
public async Task OnGetAsync() { // Populate lists required for List of Assessments results AssessmentResultsList = await _db.AssessmentResults.AsNoTracking().ToListAsync(); ModulesList = await _db.Modules.AsNoTracking().ToListAsync(); AssessmentsList = await _db.Assessments.AsNoTracking().ToListAsync(); StudentsList = await _db.Students.AsNoTracking().ToListAsync(); ProgrammesList = await _db.Programmes.AsNoTracking().ToListAsync(); if ((ProgrammeID.Length == 0) || (ProgrammeID == "All")) { ProgrammesFound = ProgrammesList.Select(p => p).ToList(); } else { ProgrammesFound = ProgrammesList.Where(p => p.ProgrammeID == ProgrammeID) .Select(p => p) .ToList(); } if (ProgrammesFound.Count() != 0) { foreach (var programme in ProgrammesFound) { var assessmentResults = AssessmentResultsList.Where(a => a.ProgrammeID == programme.ProgrammeID) .Select(a => a); foreach (var assessResult in assessmentResults) { AssessmentResultsFound.Add(assessResult); } } } else { foreach (var assessResult in AssessmentResultsList) { AssessmentResultsFound.Add(assessResult); } } }
public async Task OnGetAsync() { //get list of Students and Programmes StudentsList = await _db.Students.AsNoTracking().ToListAsync(); ProgrammesList = await _db.Programmes.AsNoTracking().ToListAsync(); if ((ProgrammeID.Length == 0) || (ProgrammeID == "All")) { ProgrammesFound = ProgrammesList.Select(p => p).ToList(); } else { ProgrammesFound = ProgrammesList.Where(p => p.ProgrammeID == ProgrammeID) .Select(p => p).ToList(); } if (ProgrammesFound.Count() != 0) { foreach (var programme in ProgrammesFound) { var students = StudentsList.Where(s => s.ProgrammeID == programme.ProgrammeID) .Select(s => s); { foreach (var stud in students) { StudentsInProgramme.Add(stud); } } } } else { foreach (var stud in StudentsList) { StudentsInProgramme.Add(stud); } } }