From 9b800dce2001183bf61ae95423f30fd33353bf21 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 17 Dec 2025 11:17:14 +0100 Subject: [PATCH] Add POST endpoint to create ResultView in controller Added a new HTTP POST action to ResultViewController that accepts a CreateResultViewCommand in the request body. On success, it returns a 201 Created response with a reference to the Get action for the created resource. This enables clients to create new ResultView entries via the API. --- src/ReC.API/Controllers/ResultViewController.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ReC.API/Controllers/ResultViewController.cs b/src/ReC.API/Controllers/ResultViewController.cs index 84cc4e9..5a8b7ec 100644 --- a/src/ReC.API/Controllers/ResultViewController.cs +++ b/src/ReC.API/Controllers/ResultViewController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc; using ReC.API.Extensions; using ReC.API.Models; +using ReC.Application.ResultViews.Commands; using ReC.Application.ResultViews.Queries; namespace ReC.API.Controllers; @@ -38,4 +39,11 @@ public class ResultViewController(IMediator mediator, IConfiguration config) : C _ => Ok(res), }; } + + [HttpPost] + public async Task Create([FromBody] CreateResultViewCommand command, CancellationToken cancel) + { + await mediator.Send(command, cancel); + return CreatedAtAction(nameof(Get), new { actionId = command.ActionId }, command); + } } \ No newline at end of file