Files
ReC/src/ReC.Application/Endpoints/Commands/UpdateEndpointCommand.cs
TekH 6681e56afc Refactor entity selection to use EntityType enum
Replaced string-based entity identifiers in CRUD procedure and command classes with a strongly-typed EntityType enum. Updated all relevant handlers and records to use the new enum property, improving type safety and maintainability. Added necessary using directives and updated documentation comments to reflect these changes.
2026-04-16 17:14:29 +02:00

26 lines
800 B
C#

using MediatR;
using ReC.Application.Common.Procedures.UpdateProcedure;
using ReC.Application.Common.Procedures.UpdateProcedure.Dto;
using ReC.Application.Common.Procedures;
namespace ReC.Application.Endpoints.Commands;
public record UpdateEndpointCommand : IUpdateProcedure<UpdateEndpointDto>
{
public long Id { get; set; }
public UpdateEndpointDto Data { get; set; } = null!;
}
public class UpdateEndpointProcedureHandler(ISender sender) : IRequestHandler<UpdateEndpointCommand, int>
{
public async Task<int> Handle(UpdateEndpointCommand request, CancellationToken cancel)
{
return await sender.Send(new UpdateObjectProcedure
{
Entity = EntityType.Endpoint,
Id = request.Id,
Endpoint = request.Data
}, cancel);
}
}