public void AddCoinByUser(Purse purse, int nominal) { var coin = purse.TakeCoinByNominal(nominal); this.Purse.Add(coin); UserMoneySumm += nominal; }
public void TakeChange(Purse toPurse) { var currenCoins = Purse.GetAllCoins().OrderByDescending(i => i.Nominal).ToList(); var changeCoins = CalculateCoins(currenCoins, UserMoneySumm); foreach (var changeCoin in changeCoins) { Purse.Dec(changeCoin); toPurse.Add(changeCoin); } UserMoneySumm = 0; }
public User() { Purse=new Purse(); }