예제 #1
0
        public async Task <bool> Handle(AddAccountCommand req, CancellationToken cancellationToken)
        {
            var accountCreatedIntegrationEvent = new AccountCreatedIntegrationEvent(req.CustomerId);
            await _integrationEventLogService.AddAndSaveEventAsync(accountCreatedIntegrationEvent);

            Account account = new Account(req.CustomerId, "the account is opened");

            await _accountRepository.CreateAsync(account);

            return(await _accountRepository.UnitOfWork.SaveEntitiesAsync());
        }