* sort block tree views * fix naming validation for block scheduling * show deco group name in deco editor * show block group name in block editor * show template group name in template editor * show deco template group name in deco template editor * fix template rename crash * fix block rename crash * fix deco template rename crash
24 lines
910 B
C#
24 lines
910 B
C#
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> decoTemplateGroups = await dbContext.DecoTemplateGroups
|
|
.AsNoTracking()
|
|
.Include(g => g.DecoTemplates)
|
|
.ToListAsync(cancellationToken);
|
|
|
|
return decoTemplateGroups.OrderBy(dtg => dtg.Name).Map(Mapper.ProjectToViewModel).ToList();
|
|
}
|
|
}
|