コード例 #1
0
ファイル: Games.cshtml.cs プロジェクト: larderino1/GameLib
        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));
            }
        }
コード例 #2
0
        public async Task <ActionResult <IEnumerable <Game> > > GetGames()
        {
            var games = await _gamesService.GetGameListAsync();

            if (games == null || games.Count() == 0)
            {
                return(NoContent());
            }

            return(Ok(games));
        }