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

@@ -60,7 +60,7 @@ public class CatalogService : ICatalogService
var entity = _mapper.Map<VwmyCatalog>(dto);
entity.Guid = id;
entity.CatTitle = existing.CatTitle;
entity.CatTitle = dto.UpdateProcedure == CatalogUpdateProcedure.Update ? existing.CatTitle : dto.CatTitle;
entity.AddedWho = existing.AddedWho;
entity.AddedWhen = existing.AddedWhen;
entity.ChangedWho = "system";

View File

@@ -27,7 +27,9 @@ public class UpdateCatalogHandler : IRequestHandler<UpdateCatalogCommand, Catalo
var entity = _mapper.Map<VwmyCatalog>(request.Dto);
entity.Guid = request.Id;
entity.CatTitle = existing.CatTitle;
entity.CatTitle = request.Dto.UpdateProcedure == CatalogUpdateProcedure.Update
? existing.CatTitle
: request.Dto.CatTitle;
entity.AddedWho = existing.AddedWho;
entity.AddedWhen = existing.AddedWhen;
entity.ChangedWho = "system";