diff --git a/Server/src/SOR.Admin/Components/Pages/Content/HighlightConfigPage.razor b/Server/src/SOR.Admin/Components/Pages/Content/HighlightConfigPage.razor index f289fc2..e51c764 100644 --- a/Server/src/SOR.Admin/Components/Pages/Content/HighlightConfigPage.razor +++ b/Server/src/SOR.Admin/Components/Pages/Content/HighlightConfigPage.razor @@ -159,8 +159,12 @@ else _message = null; try { + var normalizedType = row.Config.HighlightType.Trim(); + var normalizedTypeLower = normalizedType.ToLowerInvariant(); + row.Config.HighlightType = normalizedType; + var tracked = await Db.HighlightConfigs - .FirstOrDefaultAsync(h => string.Equals(h.HighlightType, row.Config.HighlightType, StringComparison.OrdinalIgnoreCase)); + .FirstOrDefaultAsync(h => h.HighlightType.ToLower() == normalizedTypeLower); if (tracked is null) { @@ -181,7 +185,7 @@ else _isError = false; // Re-attach the tracked entity to the row so future saves go through the tracked path. - if (!Db.HighlightConfigs.Local.Any(h => h.HighlightType == row.Config.HighlightType)) + if (!Db.HighlightConfigs.Local.Any(h => string.Equals(h.HighlightType, row.Config.HighlightType, StringComparison.OrdinalIgnoreCase))) Db.Entry(row.Config).State = Microsoft.EntityFrameworkCore.EntityState.Detached; } catch (Exception ex)