Exemplo n.º 1
0
        private async Task SeedMoviesToSee(CancellationToken cancellationToken)
        {
            logger.LogInformation("Seeding movies to see ...");

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

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

            foreach (var(id, movieInfo) in seedData.MoviesToSee)
            {
                idGeneratorQueue.EnqueueId(id.Value);
                await moviesToSeeService.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));
        }
Exemplo n.º 3
0
 protected override IQueryable <MovieToSeeModel> GetAllMovies()
 {
     return(moviesToSeeService.GetAllMovies());
 }