public async Task <IActionResult> OnGet([FromQuery] string set) { var sets = await _scryfallApi.Sets.Get(); SetList = sets.Data.OrderBy(s => s.Name).Select(s => new SelectListItem(s.Name, s.Code)).ToList(); var selectedItem = SetList.FirstOrDefault(li => li.Value.Equals(set)); if (selectedItem is not null) { selectedItem.Selected = true; CardList = (await _scryfallApi.Cards.Search($"e:{selectedItem.Value}", 1, SearchOptions.CardSort.Name)).Data; } else { CardList = new List <Card>(); } return(Page()); }