/// <summary> /// If the url slug is autogenerated, we need to update it only when the custom entity is published. /// </summary> private async Task UpdateUrlSlugIfRequiredAsync(CustomEntityVersion dbVersion, ICustomEntityDefinition definition, IExecutionContext executionContext) { if (!definition.AutoGenerateUrlSlug) { return; } var slug = SlugFormatter.ToSlug(dbVersion.Title); if (slug == dbVersion.CustomEntity.UrlSlug) { return; } var urlCommand = new UpdateCustomEntityUrlCommand() { CustomEntityId = dbVersion.CustomEntityId, LocaleId = dbVersion.CustomEntity.LocaleId, UrlSlug = slug }; await _commandExecutor.ExecuteAsync(urlCommand, executionContext); }
public Task UpdateUrlAsync(UpdateCustomEntityUrlCommand command) { return(ExtendableContentRepository.ExecuteCommandAsync(command)); }
public Task <JsonResult> PutCustomEntityUrl(int customEntityId, [FromBody] UpdateCustomEntityUrlCommand command) { return(_apiResponseHelper.RunCommandAsync(command)); }
public async Task <IActionResult> PutCustomEntityUrl(int customEntityId, [FromBody] UpdateCustomEntityUrlCommand command) { return(await _apiResponseHelper.RunCommandAsync(this, command)); }