public void Handle(CreateAccountCommand command) { var accountOwner = _accountOwnerService.GetAccountOwner(command.OwnerId); var account = new AccountAggregate(accountOwner); _accountAggregateRepository.Save(account); }
public AccountNumber GenerateNumber(Guid accountOwnerId, Guid accountTypeId) { var accountOwner = accountOwnerService.GetAccountOwner(accountOwnerId); var accountType = accountTypeRepository.Get(accountTypeId); var ownerAccountTypeCount = accountRepository.GetOwnerAccountTypeCount(accountOwnerId, accountTypeId).Result; return(new AccountNumber(accountOwner.NationalCode, accountType.Code, ownerAccountTypeCount)); }