public async Task Process(CloseInput input) { Account account = await accountReadOnlyRepository.Get(input.AccountId); account.Close(); await accountWriteOnlyRepository.Delete(account); CloseOutput output = outputConverter.Map <CloseOutput>(account); this.outputBoundary.Populate(output); }
public async Task <CloseResult> Process(CloseCommand command) { Account account = await accountReadOnlyRepository.Get(command.AccountId); account.Close(); await accountWriteOnlyRepository.Delete(account); CloseResult result = resultConverter.Map <CloseResult>(account); return(result); }
public async Task <Guid> Execute(CloseAccountCommand command) { Account account = await _accountReadOnlyRepository.Get(command.AccountId); if (account == null) { throw new AccountNotFoundException($"The account {command.AccountId} does not exist or it is already closed"); } account.Close(); await _accountWriteOnlyRepository.Delete(account); return(account.Id); }
public async Task <DeleteAccountOutput> Run(Guid accountId) { var account = await this._accountReadOnlyRepository.GetAccount(accountId); if (account == null) { throw new AccountNotFoundException("Account not found."); } await _accountWriteOnlyRepository.Delete(account.Id); return(await Task.FromResult(new DeleteAccountOutput(true))); }
public void Handle(ClosedDomainEvent domainEvent) { Account account = accountReadOnlyRepository.GetAccount(domainEvent.AggregateRootId).Result; if (account == null) { throw new AccountNotFoundException($"The account {domainEvent.AggregateRootId} does not exists or is already closed."); } if (account.Version != domainEvent.Version) { throw new TransactionConflictException(account, domainEvent); } accountWriteOnlyRepository.Delete(account).Wait(); }
public async Task Process(CloseInput input) { Account account = await accountReadOnlyRepository.Get(input.AccountId); if (account == null) { throw new AccountNotFoundException($"The account {input.AccountId} does not exists or is already closed."); } account.Close(); await accountWriteOnlyRepository.Delete(account); CloseOutput output = outputConverter.Map <CloseOutput>(account); this.outputBoundary.Populate(output); }
public async Task <CloseResult> Process(CloseCommand command) { Account account = await accountReadOnlyRepository.Get(command.AccountId); if (account == null) { throw new AccountNotFoundException($"The account {command.AccountId} does not exists or is already closed."); } account.Close(); await accountWriteOnlyRepository.Delete(account); CloseResult result = new CloseResult(account); return(result); }
public async Task Handle(CloseMessage command) { Account account = accountReadOnlyRepository.Get(command.AccountId).Result; await accountWriteOnlyRepository.Delete(account); }
public void Handle(ClosedDomainEvent domainEvent) { accountWriteOnlyRepository.Delete(domainEvent).Wait(); }