* 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
21 lines
785 B
C#
21 lines
785 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.OrderBy(bg => bg.Name).Map(Mapper.ProjectToViewModel).ToList();
|
|
}
|
|
}
|