constellation-api/CH.CQRS/Query/EnergyRateException/EnergyRateExceptionQuery.cs

22 lines
760 B
C#
Raw Permalink Normal View History

using CH.Dal;
using Microsoft.EntityFrameworkCore;
using OpenHarbor.CQRS.Abstractions;
namespace CH.CQRS.Query.EnergyRateException;
public class EnergyRateExceptionQuery
{
}
public class EnergyRateExceptionQueryHandler(CHDbContext dbContext) : IQueryHandler<EnergyRateExceptionQuery, EnergyRateExceptionQueryResult>
{
public async Task<EnergyRateExceptionQueryResult> HandleAsync(EnergyRateExceptionQuery query, CancellationToken cancellationToken = new CancellationToken())
{
var energyRateExceptions = await dbContext.EnergyRateExceptions.ToListAsync(cancellationToken);
var energyRateExceptionsQueryResult = new EnergyRateExceptionQueryResult
{
Data = energyRateExceptions,
};
return energyRateExceptionsQueryResult;
}
}