public void Execute(string id) { var account = Account.CreateAccount(id); if (account.HasChanges()) { var changes = account.GetChanges(); DomainEventsPublisher.GetInstancia().PublishEvents(changes); account.AcceptChanges(); } }
public void Execute(string accountId, decimal depositAmount) { try { var constructor = _getAccountById.GetAccountById(accountId); var account = Account.CreateAccount(constructor.AggregateId); account.BuildAggregate(constructor); account.DepositAmount(depositAmount); if (account.HasChanges()) { var changes = account.GetChanges(); DomainEventsPublisher.GetInstancia().PublishEvents(changes); account.AcceptChanges(); } } catch (Exception e) { throw e; } }
public DepositAmountController(IDepositAmountInteractor intercator, DepositAmountSuscriber suscriber) { DomainEventsPublisher.GetInstancia().ResetSuscribers(); DomainEventsPublisher.GetInstancia().RegisterSuscriber(suscriber); _interactor = intercator; }
public CreateAccountController(ICreateAccountInteractor intercator, CreateAccountSuscriber suscriber) { DomainEventsPublisher.GetInstancia().RegisterSuscriber(suscriber); _interactor = intercator; }