private async Task <List <Player> > GetBotsFromGame2(string userId, string gameId) { var botsList = new List <Player>(); List <string> botsIdList = await _gameUsersRepository.GetBotsByUserIdAndGameId(userId, gameId); if (botsIdList == null) { throw new NotFoundException(); } var result = botsIdList .Select(x => _playerRepository.Get(x).Result) .ToList(); return(botsList); }
private async Task <List <Player> > GetBotsFromGame(string userId, string gameId) { var botsList = new List <Player>(); // id bots from game var botsIdList = await _gameUsersRepository.GetBotsByUserIdAndGameId(userId, gameId); if (botsIdList == null) { throw new NotFoundException(); } // bots from game foreach (var id in botsIdList) { botsList.Add(await _playerRepository.Get(id)); } return(botsList); }