Files
ersatztv/ErsatzTV.Application/Scheduling/Commands/UpdateDefaultDecoHandler.cs
T
Jason DoveandGitHub a87ec2d75d cleanup (#1708)
* fix blazor naming

* code cleanup

* update dependencies
2024-05-06 17:00:52 -05:00

18 lines
652 B
C#

using ErsatzTV.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
namespace ErsatzTV.Application.Scheduling;
public class UpdateDefaultDecoHandler(IDbContextFactory<TvContext> dbContextFactory)
: IRequestHandler<UpdateDefaultDeco>
{
public async Task Handle(UpdateDefaultDeco request, CancellationToken cancellationToken)
{
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
await dbContext.Playouts
.Where(p => p.Id == request.PlayoutId)
.ExecuteUpdateAsync(u => u.SetProperty(p => p.DecoId, p => request.DecoId), cancellationToken);
}
}