Remove ToObjectProcedure method from InsertEndpointParamsProcedure and introduce InsertEndpointParamsProcedureHandler using MediatR's IRequestHandler. This decouples conversion and command logic, aligning with MediatR patterns and improving separation of concerns.
26 lines
837 B
C#
26 lines
837 B
C#
using MediatR;
|
|
using ReC.Application.Common.Procedures.InsertProcedure;
|
|
|
|
namespace ReC.Application.EndpointParams.Commands;
|
|
|
|
public record InsertEndpointParamsProcedure : IInsertProcedure
|
|
{
|
|
public bool? Active { get; set; }
|
|
public string? Description { get; set; }
|
|
public short? GroupId { get; set; }
|
|
public byte? Sequence { get; set; }
|
|
public string? Key { get; set; }
|
|
public string? Value { get; set; }
|
|
}
|
|
|
|
public class InsertEndpointParamsProcedureHandler(ISender sender) : IRequestHandler<InsertEndpointParamsProcedure, long>
|
|
{
|
|
public async Task<long> Handle(InsertEndpointParamsProcedure request, CancellationToken cancel)
|
|
{
|
|
return await sender.Send(new InsertObjectProcedure
|
|
{
|
|
Entity = "ENDPOINT_PARAMS",
|
|
EndpointParams = request
|
|
}, cancel);
|
|
}
|
|
} |