Refactor controllers to use [FromBody] attribute for DTO parameters and update return types for consistency

This commit is contained in:
2025-11-13 21:22:49 +00:00
parent b81c628f07
commit e9da9c7a3f
40 changed files with 87 additions and 91 deletions

View File

@@ -86,7 +86,7 @@ public class ProcessorsByMachineController(MarechaiContext context) : Controller
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
public async Task<ActionResult<long>> CreateAsync(int processorId, int machineId, float? speed)
public async Task<ActionResult<long>> CreateAsync([FromBody] ProcessorByMachineDto dto)
{
string userId = User.FindFirstValue(ClaimTypes.Sid);
@@ -94,9 +94,9 @@ public class ProcessorsByMachineController(MarechaiContext context) : Controller
var item = new ProcessorsByMachine
{
ProcessorId = processorId,
MachineId = machineId,
Speed = speed
ProcessorId = dto.ProcessorId,
MachineId = dto.MachineId,
Speed = dto.Speed
};
await context.ProcessorsByMachine.AddAsync(item);