Ejemplo n.º 1
0
 /// <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));
 }
Ejemplo n.º 2
0
        // 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
            });
        }