public void DecreaseCashBalance(decimal totalAmount) { if (cashBalance >= totalAmount) { cashBalance -= totalAmount; var e = new CashBalanceDecreasedEvent { CashBalance = cashBalance }; Apply <CashBalanceDecreasedEvent>(e) .Update <CustomerDetailReport>(r => r.cashBalance = cashBalance); } else { throw new Exception("Insufficent amount to deduct"); } }
private void OnCashBalanceDecreased(CashBalanceDecreasedEvent e) { this.cashBalance = e.CashBalance; }