From d8d75829f03d9ca0a7ee9f15e1ede2940ae60704 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 25 Nov 2025 17:15:25 +0100 Subject: [PATCH] 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. --- src/ReC.API/Controllers/ActionController.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ReC.API/Controllers/ActionController.cs b/src/ReC.API/Controllers/ActionController.cs index 5e03d86..6070956 100644 --- a/src/ReC.API/Controllers/ActionController.cs +++ b/src/ReC.API/Controllers/ActionController.cs @@ -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 Invoke([FromRoute] int profileId) + public async Task Invoke([FromRoute] int profileId) { - // Implementation for retrieving actions would go here. - throw new NotImplementedException(); + await mediator.InvokeRecAction(profileId); + return Accepted(); } } \ No newline at end of file