public void Execute(string id)
        {
            var account = Account.CreateAccount(id);

            if (account.HasChanges())
            {
                var changes = account.GetChanges();
                DomainEventsPublisher.GetInstancia().PublishEvents(changes);
                account.AcceptChanges();
            }
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
 public DepositAmountController(IDepositAmountInteractor intercator, DepositAmountSuscriber suscriber)
 {
     DomainEventsPublisher.GetInstancia().ResetSuscribers();
     DomainEventsPublisher.GetInstancia().RegisterSuscriber(suscriber);
     _interactor = intercator;
 }
예제 #4
0
 public CreateAccountController(ICreateAccountInteractor intercator, CreateAccountSuscriber suscriber)
 {
     DomainEventsPublisher.GetInstancia().RegisterSuscriber(suscriber);
     _interactor = intercator;
 }