public async Task OnGet(Guid id) { if (id != default(Guid)) { GetProgramName(id); var subPrograms = await _pMTEntityContext.PMT_SubPrograms.Where(s => s.ProgramId == id && !s.IsDeleted).OrderBy(s => s.SubProgramName).ToListAsync(); SubPrograms = subPrograms.OrderBy(s => s.SubProgramName).ToList(); var subProgramIds = SubPrograms.Select(s => s.SubProgramId); var subPrgoramLevels = _pMTEntityContext.PMT_SubProgramLevel.Where(s => subProgramIds.Contains(s.SubProgramId)).ToList(); SubProgramLevels = subPrgoramLevels.OrderBy(s => s.SubProgramLevelName).ToList(); var subPrgramLevelIds = SubProgramLevels.Select(s => s.SubProgramLevelID); TotalProgramCount = SubProgramLevels.Count(); ProgramDetailAssignment(); } }
public void OnGet(string searchString) { var subPrograms = _pMTEntityContext.PMT_SubPrograms.Where(s => searchString.Contains(s.SubProgramName)); if (subPrograms.Count() == 1) { SubPrograms = subPrograms; GetProgramName(SubPrograms.FirstOrDefault().ProgramId); } var subprogramID = SubPrograms.Select(s => s.SubProgramId).ToList(); var subLevelPrograms = _pMTEntityContext.PMT_SubProgramLevel.Where(s => subprogramID.Contains(s.SubProgramId)); SubProgramLevels = subLevelPrograms; var subPrgramLevelIds = SubProgramLevels.Select(s => s.SubProgramLevelID); TotalProgramCount = SubProgramLevels.Count(); ProgramDetailAssignment(); }