示例#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);
 }
示例#2
0
 public void PresentGame(GettingGameInfo gettingGameInfo, Player donee)
 {
     if (Balance <= gettingGameInfo.Game.Price)
     {
         throw new InvalidOperationException("Balance less then Game Price");
     }
     donee.GetGift(gettingGameInfo);
     Balance -= gettingGameInfo.Game.Price;
 }
示例#3
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;
        }