22 lines
693 B
C#
22 lines
693 B
C#
|
using CH.Dal;
|
||
|
using Microsoft.EntityFrameworkCore;
|
||
|
using OpenHarbor.CQRS.Abstractions;
|
||
|
|
||
|
namespace CH.CQRS.Query.EnergyProvider;
|
||
|
|
||
|
public class EnergyProviderQuery
|
||
|
{
|
||
|
|
||
|
}
|
||
|
public class EnergyProviderQueryHandler(CHDbContext dbContext) : IQueryHandler<EnergyProviderQuery, EnergyProviderQueryResult>
|
||
|
{
|
||
|
public async Task<EnergyProviderQueryResult> HandleAsync(EnergyProviderQuery query, CancellationToken cancellationToken = new CancellationToken())
|
||
|
{
|
||
|
var energyProviders = await dbContext.EnergyProviders.ToListAsync(cancellationToken);
|
||
|
var energyProviderQueryResult = new EnergyProviderQueryResult
|
||
|
{
|
||
|
Data = energyProviders
|
||
|
};
|
||
|
return energyProviderQueryResult;
|
||
|
}
|
||
|
}
|