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