/// <summary> /// The Account balance is the sum of all Ledger amounts. /// </summary> public static decimal Balance(this Account.LedgersRole ledgers) { return(ledgers.Sum(e => e.Amount)); }
// Use case implementations of the Account. /// <summary> /// Changing the account amount means adding an entry to the Ledgers. /// </summary> public static void AddEntry(this Account.LedgersRole ledgers, string message, decimal amount) { ledgers.Add(new LedgerEntry { Message = message, Amount = amount }); }