public void Remove(Guid gameId)
        {
            var gameInfo = GameInfos.FirstOrDefault(x => x.GameId == gameId);

            if (gameInfo != null)
            {
                GameInfos.Remove(gameInfo);
            }
            OnPropertyChanged(nameof(Games));
        }
        public void RemoveDeck(Guid deckId)
        {
            if (deckId == Guid.Empty)
            {
                return;
            }
            var games = GameInfos.Where(x => x.DeckId == deckId);

            foreach (var game in games)
            {
                GameInfos.Remove(game);
            }
            OnPropertyChanged(nameof(Games));
        }
示例#3
0
        public void ReturnGame(int gameId, int daysLimit)
        {
            var gettingGameInfo = GameInfos.Find(gameInfo => gameInfo.Game.Id == gameId);

            if (gettingGameInfo == null)
            {
                throw new InvalidOperationException();
            }

            if ((gettingGameInfo.Date - DateTime.Now).Days > daysLimit)
            {
                throw new InvalidOperationException();
            }
            if (gettingGameInfo.Payer.Id != Id)
            {
                gettingGameInfo.Payer.Balance += gettingGameInfo.Game.Price;
            }
            else
            {
                Balance += gettingGameInfo.Game.Price;
            }

            GameInfos.Remove(gettingGameInfo);
        }