public void Withdraw(decimal amount) { Balance -= amount; if (Balance < 0) { Withdrawn?.Invoke(this, new AccountArgs { Message = "You are going overdrawn" }); } }
public void Withdraw(Money money) { if (CurrentBalance - money >= new Money(0, money.Currency)) { CurrentBalance -= money; Withdrawn?.Invoke($"Со счёта списано {money.Sum} {money.Currency}"); } else { Withdrawn?.Invoke("На счёте не достаточно средств для списания."); } }
public void Withdraw(int sum) { if (_sum >= sum) { _sum -= sum; Withdrawn?.Invoke($"Со счёта снято {sum}"); } else { Withdrawn?.Invoke("На счёте недостаточно средств"); } }
public void Withdraw(int sum) { if (sum <= Sum) { Sum -= sum; Message = Withdrawn?.Invoke($"The amount of {sum} was withdrawn from the account"); } else { Message = Withdrawn?.Invoke("There is not enough money on the account"); } }
// Списание средств со счёта public void Withdraw(int sum) { if (Sum >= sum) { Sum -= sum; Withdrawn?.Invoke(this, new AccountEventArgs($"Со счёта снято: {sum}", sum)); } else { Withdrawn?.Invoke(this, new AccountEventArgs($"Недостаточно денег на счёте. Текущий баланс: {Sum}", 0)); } }
public void Withdraw(int amount) { if (_balance < amount) { var args = new WalletEventArgs($"Not enough money on wallet's balance", amount); Withdrawn?.Invoke(this, args); } else { _balance -= amount; var args = new WalletEventArgs($"{amount} of money was withdrawned from the wallet", amount); Withdrawn?.Invoke(this, args); } }