public async Task <Either <BaseError, Unit> > Handle(BuildPlayout request, CancellationToken cancellationToken) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation <BaseError, Playout> validation = await Validate(dbContext, request); return(await LanguageExtensions.Apply(validation, playout => ApplyUpdateRequest(dbContext, request, playout))); }
public async Task <Either <BaseError, Unit> > Handle( DeleteLocalLibrary request, CancellationToken cancellationToken) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation <BaseError, LocalLibrary> validation = await LocalLibraryMustExist(dbContext, request); return(await LanguageExtensions.Apply(validation, localLibrary => DoDeletion(dbContext, localLibrary))); }
public async Task <Either <BaseError, Unit> > Handle( UpdateCollectionCustomOrder request, CancellationToken cancellationToken) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation <BaseError, Collection> validation = await Validate(dbContext, request); return(await LanguageExtensions.Apply(validation, c => ApplyUpdateRequest(dbContext, c, request))); }
public async Task <Either <BaseError, IEnumerable <ProgramScheduleItemViewModel> > > Handle( ReplaceProgramScheduleItems request, CancellationToken cancellationToken) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation <BaseError, ProgramSchedule> validation = await Validate(dbContext, request); return(await LanguageExtensions.Apply(validation, ps => PersistItems(dbContext, request, ps))); }
public async Task <Either <BaseError, Unit> > Handle( AddSeasonToCollection request, CancellationToken cancellationToken) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation <BaseError, Parameters> validation = await Validate(dbContext, request); return(await LanguageExtensions.Apply(validation, parameters => ApplyAddSeasonRequest(dbContext, parameters))); }
public async Task <Either <BaseError, Unit> > Handle( MoveLocalLibraryPath request, CancellationToken cancellationToken) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation <BaseError, Parameters> validation = await Validate(dbContext, request); return(await LanguageExtensions.Apply(validation, parameters => MovePath(dbContext, parameters))); }
public async Task <Either <BaseError, UpdateProgramScheduleResult> > Handle( UpdateProgramSchedule request, CancellationToken cancellationToken) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation <BaseError, ProgramSchedule> validation = await Validate(dbContext, request); return(await LanguageExtensions.Apply(validation, ps => ApplyUpdateRequest(dbContext, ps, request))); }
public async Task <Either <BaseError, LocalLibraryViewModel> > Handle( CreateLocalLibrary request, CancellationToken cancellationToken) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation <BaseError, LocalLibrary> validation = await Validate(dbContext, request); return(await LanguageExtensions.Apply(validation, localLibrary => PersistLocalLibrary(dbContext, localLibrary))); }
public async Task <Either <BaseError, string> > Handle( GetHlsPlaylistByChannelNumber request, CancellationToken cancellationToken) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); DateTimeOffset now = DateTimeOffset.Now; Validation <BaseError, Parameters> validation = await Validate(dbContext, request, now); return(await LanguageExtensions.Apply( validation, parameters => GetPlaylist(dbContext, request, parameters, now))); }
public async Task <Either <BaseError, Unit> > Handle( DeleteTraktList request, CancellationToken cancellationToken) { try { await using TvContext dbContext = _dbContextFactory.CreateDbContext(); Validation <BaseError, TraktList> validation = await TraktListMustExist(dbContext, request.TraktListId); return(await LanguageExtensions.Apply(validation, c => DoDeletion(dbContext, c))); } finally { _entityLocker.UnlockTrakt(); } }