From 94da75ce3729263026cfdedc7211d4e03ed73af1 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 24 Mar 2026 10:14:10 +0100 Subject: [PATCH] Add MediatR handler for DeleteProfileProcedure command Introduce DeleteProfileProcedureHandler using MediatR's IRequestHandler to process DeleteProfileProcedure requests. The handler sends a DeleteObjectProcedure via ISender, replacing the previous ToObjectProcedure method. Also, add necessary using directives and refactor logic to centralize command handling. --- .../Profile/Commands/DeleteProfileProcedure.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/ReC.Application/Profile/Commands/DeleteProfileProcedure.cs b/src/ReC.Application/Profile/Commands/DeleteProfileProcedure.cs index 784984e..085d4a3 100644 --- a/src/ReC.Application/Profile/Commands/DeleteProfileProcedure.cs +++ b/src/ReC.Application/Profile/Commands/DeleteProfileProcedure.cs @@ -1,3 +1,4 @@ +using MediatR; using ReC.Application.Common.Procedures.DeleteProcedure; namespace ReC.Application.Profile.Commands; @@ -18,15 +19,18 @@ public record DeleteProfileProcedure : IDeleteProcedure /// If true, delete even if dependent ACTION data exists /// public bool Force { get; set; } +} - public DeleteObjectProcedure ToObjectProcedure() +public class DeleteProfileProcedureHandler(ISender sender) : IRequestHandler +{ + public async Task Handle(DeleteProfileProcedure request, CancellationToken cancel) { - return new DeleteObjectProcedure + return await sender.Send(new DeleteObjectProcedure { Entity = "PROFILE", - Start = Start, - End = End, - Force = Force - }; + Start = request.Start, + End = request.End, + Force = request.Force + }, cancel); } -} +} \ No newline at end of file