public async Task <string> CreateGiftcard(CreateGiftcardCommand command, CancellationToken cancellationToken = default) { try { return(await _accountsCommandHandler.ExecuteAsync(command, cancellationToken)); } catch (Exception ex) { throw ex; } }
public async Task <string> ExecuteAsync(CreateGiftcardCommand command, CancellationToken cancellationToken = default) { try { // validate command ValidateCommand(command); var account = command.ToDomain(); await _accountRepository.AddAsync(account, cancellationToken); await _accountRepository.SaveChangesAsync(cancellationToken); // add the account transaction into the blockchain await AddBlockToBlockchain(account); return(account.AccountId); } catch (Exception ex) { throw ex; } }