diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs index ffc2d45e3fc..882b33e6350 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs @@ -1,12 +1,10 @@ using System.Linq; -using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Settings; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Localization; -using Microsoft.Extensions.Options; using OrchardCore.Admin; using OrchardCore.ContentManagement; using OrchardCore.ContentManagement.Display; @@ -321,7 +319,10 @@ public async Task Delete(string taxonomyContentItemId, string tax return NotFound(); } - taxonomy.As().Content.Remove(taxonomyItemId); + taxonomy.Alter(part => + { + part.Terms = part.Terms.Where(x => x.ContentItemId != taxonomyItemId).ToList(); + }); await _session.SaveAsync(taxonomy); diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemConverter.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemConverter.cs index fa4b82c08e9..7e26f0bea82 100644 --- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemConverter.cs +++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemConverter.cs @@ -91,10 +91,11 @@ public override ContentItem Read(ref Utf8JsonReader reader, Type typeToConvert, contentItem.Owner = reader.TokenType == JsonTokenType.String ? reader.GetString() : null; break; default: - if (reader.TokenType == JsonTokenType.StartObject) + if (reader.TokenType == JsonTokenType.StartObject || + reader.TokenType == JsonTokenType.StartArray) { var property = JNode.Load(ref reader); - contentItem.Data.Add(propertyName, property); + contentItem.Data[propertyName] = property; } break;