Restrict CatTitle editing based on UpdateProcedure

Enforce business rules for catalog title changes: only allow CatTitle to be edited when UpdateProcedure permits, with checks in the API, service, handler, and UI. This ensures consistent validation and user experience across backend and frontend.
This commit is contained in:
OlgunR
2026-01-19 14:44:55 +01:00
parent 26f783e835
commit 0af0c4589d
4 changed files with 8 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
using DbFirst.Application.Catalogs;
using DbFirst.Application.Catalogs.Commands;
using DbFirst.Application.Catalogs.Queries;
using DbFirst.Domain;
using MediatR;
using Microsoft.AspNetCore.Mvc;
@@ -54,7 +55,8 @@ public class CatalogsController : ControllerBase
{
return NotFound();
}
if (!string.Equals(current.CatTitle, dto.CatTitle, StringComparison.OrdinalIgnoreCase))
if (dto.UpdateProcedure == CatalogUpdateProcedure.Update &&
!string.Equals(current.CatTitle, dto.CatTitle, StringComparison.OrdinalIgnoreCase))
{
return BadRequest("Titel kann nicht geändert werden.");
}