public void PayWithCash(double insertedMoney) { Math.Max(Math.Round(RemainingPriceToPay - insertedMoney, 2), 0); RemainingPriceChanged.Invoke(this, new PriceChanged { RemainingPrice = RemainingPriceToPay, InsertedMoney = insertedMoney, UserRepository = _users }); }
public void PayWithCard(string selectedPaymentCard) { double insertedMoney = _users.Cards[selectedPaymentCard]; if (RemainingPriceToPay <= insertedMoney) { _users.Cards[selectedPaymentCard] = insertedMoney - RemainingPriceToPay; RemainingPriceToPay = 0; } else { _users.Cards[selectedPaymentCard] = 0; RemainingPriceToPay -= insertedMoney; } RemainingPriceChanged.Invoke(this, new PriceChanged { RemainingPrice = RemainingPriceToPay, InsertedMoney = insertedMoney, UserRepository = _users }); }