public ActionResult Debit(DebitAccountCommand command) { try { Configuration.Instance().Bus.Handle(command); } catch (AccountLockedException) { return RedirectToAction("Locked", new { accountId = command.AccountId }); } return RedirectToAction("Debited", new { accountId = command.AccountId }); }
public void Handle(DebitAccountCommand command) { var account = _repository.GetById<Account>(command.AccountId); account.Debit(command.Amount); _repository.Save(account); }