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); }
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; }