public void Withdraw(decimal amount) { if (_state.Equals(AccountState.BLOCKED)) { throw new Exception(" This Account is blocked, you cannot withdraw funds"); } if (amount < 0) { throw new InvalidOperationException("negative amount"); } if ((_funds - amount) <= -_overDraftLimit) { BlockAccount(); } var WithdrawSuccededEvt = new WithdrawSuccededEvent(guid.ToString(), amount, EventReasons.NONE); Append(WithdrawSuccededEvt); Apply(WithdrawSuccededEvt); }
private void Apply(WithdrawSuccededEvent evt) { _funds -= evt.Amount; }
public Task Handle(WithdrawSuccededEvent message, IMessageHandlerContext context) { throw new NotImplementedException(); }