Files
ersatztv/ErsatzTV.Application/Scheduling/Queries/GetAllBlockGroupsHandler.cs
T
Jason DoveandGitHub 2a9f23cce6 update layout for group editors (#2140)
* update block group editor

* update playlist group editor

* update template group editor

* update deco group editor

* update deco template group editor

* update deco editor

* update logs layout

* update changelog
2025-07-12 13:45:50 +00:00

21 lines
762 B
C#

using ErsatzTV.Core.Domain.Scheduling;
using ErsatzTV.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Scheduling;
public class GetAllBlockGroupsHandler(IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<GetAllBlockGroups, List<BlockGroupViewModel>>
{
public async Task<List<BlockGroupViewModel>> Handle(GetAllBlockGroups request, CancellationToken cancellationToken)
{
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
List<BlockGroup> blockGroups = await dbContext.BlockGroups
.AsNoTracking()
.ToListAsync(cancellationToken);
return blockGroups.Map(Mapper.ProjectToViewModel).ToList();
}
}