Пример #1
0
        public void AddGameToCollection(int gameId, UserSkillLevel skillLevel, UserSkillLevel willingToPlayWith,
                                        bool ownsAllComponents, bool gameMaster, bool activelyLooking)
        {
            var existingGame = gameCollection.SingleOrDefault(x => x.GameId == gameId);

            if (existingGame != null)
            {
                UpdateGameInCollection(existingGame.Id, skillLevel, willingToPlayWith, ownsAllComponents, gameMaster,
                                       activelyLooking);
            }
            else
            {
                var userGame = new UserGame()
                {
                    GameId            = gameId,
                    SkillLevel        = skillLevel,
                    WillingToPlayWith = willingToPlayWith,
                    OwnsAllComponents = ownsAllComponents,
                    GameMaster        = gameMaster,
                    ActivelyLooking   = activelyLooking
                };

                gameCollection.Add(userGame);
            }
        }
Пример #2
0
        public void UpdateGameInCollection(long userGameId, UserSkillLevel skillLevel, UserSkillLevel willingToPlayWith,
                                           bool ownsAllComponents, bool gameMaster, bool activelyLooking)
        {
            var existingGame = gameCollection.SingleOrDefault(x => x.Id == userGameId);

            existingGame.SkillLevel        = skillLevel;
            existingGame.WillingToPlayWith = willingToPlayWith;
            existingGame.OwnsAllComponents = ownsAllComponents;
            existingGame.GameMaster        = gameMaster;
            existingGame.ActivelyLooking   = activelyLooking;
        }