23 lines
676 B
C#
23 lines
676 B
C#
|
using CH.CQRS.Query.EnergyProvider;
|
||
|
using CH.Dal;
|
||
|
using Microsoft.EntityFrameworkCore;
|
||
|
using OpenHarbor.CQRS.Abstractions;
|
||
|
|
||
|
namespace CH.CQRS.Query.EnergyRate;
|
||
|
|
||
|
public class EnergyRateQuery
|
||
|
{
|
||
|
|
||
|
}
|
||
|
public class EnergyRateQueryHandler(CHDbContext dbContext) : IQueryHandler<EnergyRateQuery, EnergyRateQueryResult>
|
||
|
{
|
||
|
public async Task<EnergyRateQueryResult> HandleAsync(EnergyRateQuery query, CancellationToken cancellationToken = new CancellationToken())
|
||
|
{
|
||
|
var energyRates = await dbContext.EnergyRates.ToListAsync(cancellationToken);
|
||
|
var energyRateQueryResult = new EnergyRateQueryResult
|
||
|
{
|
||
|
Data = energyRates
|
||
|
};
|
||
|
return energyRateQueryResult;
|
||
|
}
|
||
|
}
|