public async Task <SetActiveAccountResult> ExecuteCommandAsync(IqOptionAggregate aggregate, SetActiveAccountcommand command, CancellationToken cancellationToken) { var query = $@"UPDATE IqOptionAccount SET IsActive = {command.IsActive}, UpdatedOn = getdate() WHERE IqOptionAccount.IqOptionUserId = '{command.UserId}'"; var result = await _connection().ExecuteAsync(query); return(new SetActiveAccountResult((int)result == 1)); }
public async Task <CommandResult> ExecuteCommandAsync(IqAggregate aggregate, SetActiveAccountcommand command, CancellationToken cancellationToken) { var query = $@"UPDATE IqOptionAccount SET IsActive = @IsActive, UpdatedOn = getdate() WHERE IqOptionAccount.IqOptionUserId = @UserId"; var result = await _sqlWrapper.ExecuteAsync(query, new { IsActive = command.StatusItem.IsActive, UserId = command.StatusItem.UserId }); //publish to bus await _activeAccountBusSender.SendAsync(command.StatusItem, cancellationToken); return(new CommandResult(result == 1)); }