public IActionResult GetSSALevelTwo(string Level1Id) { if (string.IsNullOrEmpty(Level1Id)) { return(Json(Enumerable.Empty <SelectListItem>())); } var level2s = new SectorSubjectAreaTier().SectorSubjectAreaTierAll .Where(t => t.Id == Level1Id) .SelectMany(s => s.SectorSubjectAreaTier2 .Select(s => new SelectListItem { Text = s.Value, Value = s.Key })); return(Json(new[] { new SelectListItem { Text = "Choose SSA level 2", Value = "" } }.Concat(level2s))); }
public IActionResult UnknownZCode() { RemoveSessionVariables(); var ssaLevel1 = new SectorSubjectAreaTier().SectorSubjectAreaTierAll .Select(y => new SSAOptions() { Id = y.Id, Description = y.Description }) .ToList(); var model = new UnRegulatedNotFoundViewModel { ssaLevel1 = ssaLevel1 }; if (ssaLevel1 == null || !ssaLevel1.Any()) { return(View(model)); } model.Level1 = new[] { new SelectListItem { Text = "Choose SSA level 1", Value = "" } } .Concat(ssaLevel1.Select(s => new SelectListItem { Text = s.Description, Value = s.Id })) .ToList(); model.Level2 = new List <SelectListItem> { new SelectListItem { Text = "Choose SSA level 2", Value = "" } }; return(View(model)); }