mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
871 B
23 lines
871 B
using ErsatzTV.Core.Domain.Scheduling; |
|
using ErsatzTV.Infrastructure.Data; |
|
using Microsoft.EntityFrameworkCore; |
|
|
|
namespace ErsatzTV.Application.Scheduling; |
|
|
|
public class GetAllDecoTemplateGroupsHandler(IDbContextFactory<TvContext> dbContextFactory) |
|
: IRequestHandler<GetAllDecoTemplateGroups, List<DecoTemplateGroupViewModel>> |
|
{ |
|
public async Task<List<DecoTemplateGroupViewModel>> Handle( |
|
GetAllDecoTemplateGroups request, |
|
CancellationToken cancellationToken) |
|
{ |
|
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken); |
|
|
|
List<DecoTemplateGroup> blockGroups = await dbContext.DecoTemplateGroups |
|
.AsNoTracking() |
|
.Include(g => g.DecoTemplates) |
|
.ToListAsync(cancellationToken); |
|
|
|
return blockGroups.Map(Mapper.ProjectToViewModel).ToList(); |
|
} |
|
}
|
|
|