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.
This commit is contained in:
@@ -54,6 +54,10 @@ public class CatalogsController : ControllerBase
|
|||||||
{
|
{
|
||||||
return NotFound();
|
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);
|
var updated = await _mediator.Send(new UpdateCatalogCommand(id, dto), cancellationToken);
|
||||||
if (updated == null)
|
if (updated == null)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ else if (!string.IsNullOrWhiteSpace(infoMessage))
|
|||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label class="form-label">Titel</label>
|
<label class="form-label">Titel</label>
|
||||||
<InputText class="form-control" @bind-Value="formModel.CatTitle" />
|
<InputText class="form-control" @bind-Value="formModel.CatTitle" disabled="@isEditing" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label class="form-label">Kennung</label>
|
<label class="form-label">Kennung</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user