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:
@@ -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.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user