public async Task OnGetAsync() { // Not lists are populated without a search string if (!String.IsNullOrEmpty(ProgrammeSearchString)) { ProgrammeList = await _db.Programmes.AsNoTracking().ToListAsync(); ProgrammesFound = ProgrammeList.Where(s => s.ProgrammeName.Contains(ProgrammeSearchString)) .Select(s => s) .ToList(); if (ProgrammesFound.Count() != 0) { ProgrammeModuleList = await _db.ProgrammeModules.AsNoTracking().ToListAsync(); //get list of Modules, ProgrammeModules and Programmes, Assessments ModuleList = await _db.Modules.AsNoTracking().ToListAsync(); // Populate ModulesInProgramme foreach (var progMod in ProgrammeModuleList) { ModulesInProgramme.Add(progMod.ProgrammeID + progMod.ModuleID, progMod.ProgrammeID); } AssessmentList = await _db.Assessments.AsNoTracking().ToListAsync(); } } }
public async Task OnGetAsync() { //get list of Programmes ProgrammeList = await _db.Programmes.AsNoTracking().ToListAsync(); if (!String.IsNullOrEmpty(ProgrammeSearchString)) { ProgrammesFound = ProgrammeList.Where(s => s.ProgrammeName.Contains(ProgrammeSearchString)) .Select(s => s) .ToList(); } else { ProgrammesFound = ProgrammeList.ToList(); } }