29 lines
837 B
C#
29 lines
837 B
C#
using CH.CQRS.Service.Energy;
|
|
using CH.CQRS.Service.Energy.Options;
|
|
using FluentValidation;
|
|
using OpenHarbor.CQRS.Abstractions;
|
|
|
|
namespace CH.CQRS.Command.Energy;
|
|
|
|
public class EnableEnergyProviderCommand
|
|
{
|
|
public long ProviderId { get; set; }
|
|
}
|
|
public class EnableEnergyProviderCommandHandler(EnergyService energyService) : ICommandHandler<EnableEnergyProviderCommand>
|
|
{
|
|
public Task HandleAsync(EnableEnergyProviderCommand command, CancellationToken cancellationToken = new CancellationToken())
|
|
{
|
|
return energyService.EnableEnergyProviderAsync(new EnableEnergyProviderCommandOptions()
|
|
{
|
|
ProviderId = command.ProviderId
|
|
}, cancellationToken);
|
|
}
|
|
}
|
|
|
|
public class EnableEnergyProviderCommandValidator : AbstractValidator<EnableEnergyProviderCommand>
|
|
{
|
|
public EnableEnergyProviderCommandValidator()
|
|
{
|
|
|
|
}
|
|
} |