Exemplo n.º 1
0
 public void GetGift(GettingGameInfo newGettingGameInfo)
 {
     if (GameInfos.Any(buy => buy.Game.Equals(newGettingGameInfo.Game)))
     {
         throw new InvalidOperationException("Game already exist in User Account");
     }
     GameInfos.Add(newGettingGameInfo);
 }
Exemplo n.º 2
0
        public void BuyGame(GettingGameInfo newGettingGameInfo)
        {
            if (GameInfos.Any(buy => buy.Game.Equals(newGettingGameInfo.Game)))
            {
                throw new InvalidOperationException("Game already exist in User Account");
            }

            if (Balance <= newGettingGameInfo.Game.Price)
            {
                throw new InvalidOperationException("Balance less then Game Price");
            }

            GameInfos.Add(newGettingGameInfo);
            Balance -= newGettingGameInfo.Game.Price;
        }