Refactor ActionController to use MediatR
Updated `using` directives to include MediatR and related namespaces. Refactored `ActionController` to use constructor injection for `IMediator`. Modified the `Invoke` method to be asynchronous and replaced the placeholder `NotImplementedException` with a call to `mediator.InvokeRecAction(profileId)`. The method now returns an `Accepted` HTTP response to indicate successful request processing.
This commit is contained in:
parent
5697eb3dd8
commit
d8d75829f0
@ -1,15 +1,17 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using MediatR;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using ReC.Application.RecActions.Commands;
|
||||||
|
|
||||||
namespace ReC.API.Controllers;
|
namespace ReC.API.Controllers;
|
||||||
|
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class ActionController : ControllerBase
|
public class ActionController(IMediator mediator) : ControllerBase
|
||||||
{
|
{
|
||||||
[HttpPost("{profileId}")]
|
[HttpPost("{profileId}")]
|
||||||
public Task<IActionResult> Invoke([FromRoute] int profileId)
|
public async Task<IActionResult> Invoke([FromRoute] int profileId)
|
||||||
{
|
{
|
||||||
// Implementation for retrieving actions would go here.
|
await mediator.InvokeRecAction(profileId);
|
||||||
throw new NotImplementedException();
|
return Accepted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user