コード例 #1
0
        /// <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);
        }
コード例 #2
0
 public Task UpdateUrlAsync(UpdateCustomEntityUrlCommand command)
 {
     return(ExtendableContentRepository.ExecuteCommandAsync(command));
 }
コード例 #3
0
 public Task <JsonResult> PutCustomEntityUrl(int customEntityId, [FromBody] UpdateCustomEntityUrlCommand command)
 {
     return(_apiResponseHelper.RunCommandAsync(command));
 }
コード例 #4
0
 public async Task <IActionResult> PutCustomEntityUrl(int customEntityId, [FromBody] UpdateCustomEntityUrlCommand command)
 {
     return(await _apiResponseHelper.RunCommandAsync(this, command));
 }