Add [FromBody] to DTO params in controller actions

Explicitly annotate DTO parameters with [FromBody] in CatalogsController (Create, Update) and MassDataController (Upsert) to ensure correct model binding from the request body and improve API clarity.
This commit is contained in:
OlgunR
2026-04-21 15:22:33 +02:00
parent 087708dcf7
commit b35c167648
2 changed files with 3 additions and 3 deletions

View File

@@ -36,7 +36,7 @@ public class CatalogsController : ControllerBase
}
[HttpPost]
public async Task<ActionResult<CatalogReadDto>> Create(CatalogWriteDto dto, CancellationToken cancellationToken)
public async Task<ActionResult<CatalogReadDto>> Create([FromBody]CatalogWriteDto dto, CancellationToken cancellationToken)
{
var created = await _mediator.Send(new CreateCatalogCommand(dto), cancellationToken);
if (created == null)
@@ -47,7 +47,7 @@ public class CatalogsController : ControllerBase
}
[HttpPut("{id:int}")]
public async Task<ActionResult<CatalogReadDto>> Update(int id, CatalogWriteDto dto, CancellationToken cancellationToken)
public async Task<ActionResult<CatalogReadDto>> Update(int id, [FromBody] CatalogWriteDto dto, CancellationToken cancellationToken)
{
var updated = await _mediator.Send(new UpdateCatalogCommand(id, dto), cancellationToken);
if (updated == null)