Exemple #1
0
        public IEnumerable <GameTable> GetAllGameTablesWithoutResultsByGamerNickname(string gamerNickname)
        {
            var gameTablesWithoutResults = new List <GameTable>();
            var gameTableList            = GetAllGameTablesByGamerNickname(gamerNickname);

            foreach (var gameTable in gameTableList)
            {
                var tableResults = _gameResultRepository.GetAllByTableId(gameTable.Id);
                var tableBoardGamesWithResultIds = tableResults.Select(x => x.BoardGameId).ToList();
                var gameTableBoardGameIds        = gameTable.BoardGames?.Select(x => x.Id).ToList();


                if (gameTableBoardGameIds != null && tableBoardGamesWithResultIds.Count != 0 &&
                    !tableBoardGamesWithResultIds.SequenceEqual(gameTableBoardGameIds))
                {
                    gameTable.BoardGames.RemoveAll(x => tableBoardGamesWithResultIds.Contains(x.Id));
                    gameTablesWithoutResults.Add(gameTable);
                }
            }

            return(gameTablesWithoutResults);
        }
 public IEnumerable <GameResult> GetAllGameResultsByTableId(int id)
 {
     return(_gameResultRepository.GetAllByTableId(id));
 }