Add UpdateObject endpoint and enhance procedure support
Enhanced `CommonController` to support object operations: - Added `using` statements for Insert, Update, and Delete procedures. - Updated constructor to inject `IMediator` for request handling. - Introduced `UpdateObject` endpoint with HTTP PUT support. - Processes `UpdateObjectProcedure` via MediatR. - Returns HTTP 200 OK with the result.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ReC.Application.Common.Procedures.DeleteProcedure;
|
||||
using ReC.Application.Common.Procedures.InsertProcedure;
|
||||
using ReC.Application.Common.Procedures.UpdateProcedure;
|
||||
|
||||
namespace ReC.API.Controllers;
|
||||
|
||||
@@ -14,4 +16,11 @@ public class CommonController(IMediator mediator) : ControllerBase
|
||||
var id = await mediator.Send(procedure, cancel);
|
||||
return StatusCode(StatusCodes.Status201Created, id);
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public async Task<IActionResult> UpdateObject([FromBody] UpdateObjectProcedure procedure, CancellationToken cancel)
|
||||
{
|
||||
var result = await mediator.Send(procedure, cancel);
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user