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;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ActionController : ControllerBase
|
||||
public class ActionController(IMediator mediator) : ControllerBase
|
||||
{
|
||||
[HttpPost("{profileId}")]
|
||||
public Task<IActionResult> Invoke([FromRoute] int profileId)
|
||||
public async Task<IActionResult> Invoke([FromRoute] int profileId)
|
||||
{
|
||||
// Implementation for retrieving actions would go here.
|
||||
throw new NotImplementedException();
|
||||
await mediator.InvokeRecAction(profileId);
|
||||
return Accepted();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user