From 26f783e835b6e57455374486b00360fd696fbc1d Mon Sep 17 00:00:00 2001 From: OlgunR Date: Mon, 19 Jan 2026 11:21:33 +0100 Subject: [PATCH] Prevent catalog title changes during edit Enforce immutability of CatTitle on updates: backend now rejects title changes with a BadRequest, and frontend disables the title input field when editing. --- DbFirst.API/Controllers/CatalogsController.cs | 4 ++++ DbFirst.BlazorWasm/Pages/Catalogs.razor | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/DbFirst.API/Controllers/CatalogsController.cs b/DbFirst.API/Controllers/CatalogsController.cs index b2b0f66..103d386 100644 --- a/DbFirst.API/Controllers/CatalogsController.cs +++ b/DbFirst.API/Controllers/CatalogsController.cs @@ -54,6 +54,10 @@ public class CatalogsController : ControllerBase { return NotFound(); } + if (!string.Equals(current.CatTitle, dto.CatTitle, StringComparison.OrdinalIgnoreCase)) + { + return BadRequest("Titel kann nicht geändert werden."); + } var updated = await _mediator.Send(new UpdateCatalogCommand(id, dto), cancellationToken); if (updated == null) diff --git a/DbFirst.BlazorWasm/Pages/Catalogs.razor b/DbFirst.BlazorWasm/Pages/Catalogs.razor index 0486b46..2c2ef09 100644 --- a/DbFirst.BlazorWasm/Pages/Catalogs.razor +++ b/DbFirst.BlazorWasm/Pages/Catalogs.razor @@ -24,7 +24,7 @@ else if (!string.IsNullOrWhiteSpace(infoMessage))
- +