public async Task <RedirectToActionResult> DeleteMovie([FromForm] string id, CancellationToken cancellationToken) { var movieId = CreateMovieId(id); await moviesToSeeService.DeleteMovie(movieId, cancellationToken); TempData[TempDataDeletedMovie] = true; return(RedirectToAction("Index")); }
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); } }