예제 #1
0
        public void Withdraw(Withdrawal withdrawal)
        {
            if (!IsAccountOpen)
            {
                throw new ApplicationException("Account is not open");
            }

            var withdrawnEvent = new AmountWithdrawnEvent(
                withdrawal.WithdrawalId,
                withdrawal.Amount,
                withdrawal.Date,
                withdrawal.AccountId);

            ApplyChange(withdrawnEvent);
        }
예제 #2
0
 private void Apply(AmountWithdrawnEvent @event)
 {
     CurrentBalance -= @event.Amount;
 }