diff --git a/src/infrastructure/DigitalData.TaskFlow.Infrastructure/Repositories/WorkflowRepository.cs b/src/infrastructure/DigitalData.TaskFlow.Infrastructure/Repositories/WorkflowRepository.cs index 2487116..452687f 100644 --- a/src/infrastructure/DigitalData.TaskFlow.Infrastructure/Repositories/WorkflowRepository.cs +++ b/src/infrastructure/DigitalData.TaskFlow.Infrastructure/Repositories/WorkflowRepository.cs @@ -19,4 +19,35 @@ public sealed class WorkflowRepository(TaskFlowDbContext context) : IWorkflowRep return rows.FirstOrDefault(); } + + public async Task CloseAsync( + int userId, + string source, + long processId, + int closingMethodId, + string? comment, + byte? rejectionReasonId, + CancellationToken cancellationToken) + { + var rows = await context.WorkflowClosings + .FromSqlInterpolated($@" +DECLARE @ResultCode INT; +DECLARE @ResultMessage NVARCHAR(400); + +EXEC dbo.PRCUST_F19_CLOSING + @UserID = {userId}, + @Source = {source}, + @ProcessID = {processId}, + @ClosingMethodID = {closingMethodId}, + @Comment = {comment}, + @RejectionReasonID = {rejectionReasonId}, + @ResultCode = @ResultCode OUTPUT, + @ResultMessage = @ResultMessage OUTPUT; + +SELECT @ResultCode AS CODE, @ResultMessage AS RESULT;") + .AsNoTracking() + .ToListAsync(cancellationToken); + + return rows.FirstOrDefault(); + } }