// Class Methods public void MakeDeposit(decimal amount, DateTime date, string note) { if (amount <= 0) { throw new ArgumentOutOfRangeException(nameof(amount), "Amount of deposit must be positive"); } var deposit = new Transcation(amount, date, note); allTransactions.Add(deposit); }
public void MakeWithdrawal(decimal amount, DateTime date, string note) { if (amount <= 0) { throw new ArgumentOutOfRangeException(nameof(amount), "Amount of withdrawal must be positive"); } if (Balance - amount < 0) { throw new InvalidOperationException("No sufficient funds for this withdrawal"); } var transaction = new Transcation(-amount, date, note); allTransactions.Add(transaction); }