示例#1
0
        private async Task SeedMoviesToGet(CancellationToken cancellationToken)
        {
            logger.LogInformation("Seeding movies to get ...");

            var oldMovies = moviesToGetService.GetAllMovies().ToList();

            logger.LogInformation("Deleting movies to get: {DeletedMoviesToGet}", oldMovies.Select(x => x.Id.Value));
            foreach (var oldMovie in oldMovies)
            {
                await moviesToGetService.DeleteMovie(oldMovie.Id, cancellationToken);
            }

            foreach (var(id, movieInfo) in seedData.MoviesToGet)
            {
                idGeneratorQueue.EnqueueId(id.Value);
                await moviesToGetService.AddMovie(movieInfo, cancellationToken);
            }
        }
        public Task <MovieUniquenessCheckResult> CheckMovie(Uri movieUri, CancellationToken cancellationToken)
        {
            var moviesToGet = moviesToGetService.GetAllMovies();

            if (moviesToGet.Any(x => x.MovieInfo.MovieUri == movieUri))
            {
                return(Task.FromResult(MovieUniquenessCheckResult.ExistsInMoviesToGet));
            }

            var moviesToSee = moviesToSeeService.GetAllMovies();

            if (moviesToSee.Any(x => x.MovieInfo.MovieUri == movieUri))
            {
                return(Task.FromResult(MovieUniquenessCheckResult.ExistsInMoviesToSee));
            }

            return(Task.FromResult(MovieUniquenessCheckResult.MovieIsUnique));
        }
示例#3
0
 protected override IQueryable <MovieToGetModel> GetAllMovies()
 {
     return(moviesToGetService.GetAllMovies());
 }