public async Task OnGet() { Games = await _gameService.GetGameListAsync(); if (Games == null) { Games = new List <Game>(); } if (!string.IsNullOrEmpty(SearchString)) { Games = Games.Where( s => s.Name.Contains(SearchString) || s.Mode.Name.Contains(SearchString) || s.Platform.Name.Contains(SearchString) || s.Studio.Contains(SearchString) || s.Genre.Name.Contains(SearchString) || s.Author.Contains(SearchString) || s.Category.Name.Contains(SearchString) || s.Country.Contains(SearchString)); } }
public async Task <ActionResult <IEnumerable <Game> > > GetGames() { var games = await _gamesService.GetGameListAsync(); if (games == null || games.Count() == 0) { return(NoContent()); } return(Ok(games)); }