/// <summary> /// Withdraw from account /// </summary> /// <param name="amount">Amount to be withdrawed</param> public virtual void PayOut(double amount) { _balance -= amount; _changedDate = DateTime.Now; Console.WriteLine($"The amount {amount} has been withdrawn from your account. Current balance: {Balance}"); Transaktion transaktion = new Transaktion(_changedDate, amount, _balance, "Auszahlung"); Transaktionen.Add(transaktion); }
/// <summary> /// Deposit money to account /// </summary> /// <param name="amount">Amount to be deposited</param> public virtual void PayIn(double amount) { if (amount > 0.0) { Console.WriteLine($"Balance was {Balance}. Current balance {_balance += amount} "); _changedDate = DateTime.Now; Transaktion transaktion = new Transaktion(_changedDate, amount, _balance, "Einzahlung"); Transaktionen.Add(transaktion); } else { throw new KtoException(-3, "Negativen Wert gilt nicht für Einzahlen"); } }