public void AddNewMovieToDatabase_AddMovie_IsTrue() { // Arrange _movie = new MovieDto(); // Act _movie.Title = "NEW MOVIE"; _movieData.AddMovie(_movie); _movieList = _movieData.GetAllMovies(); _movie.Id = _movieList.Find(t => t.Title == "NEW MOVIE").Id; // Assert Assert.IsTrue(_movieList.Find(t => t.Title == "NEW MOVIE").Title == "NEW MOVIE"); // Cleanup _movieData.RemoveMovie(_movie); }
public IActionResult OnPost() { if (ModelState.IsValid) { Movie.Genres = new List <Genre>(); for (int i = 0; i < SelectedGenres.Length; i++) { if (SelectedGenres[i]) { Movie.Genres.Add((Genre)i); } } movieData.AddMovie(Movie); TempData["Message"] = $"Movie { Movie.Titel } was added to the collection"; return(RedirectToPage("../Index")); } Genres = Enum.GetValues(typeof(Genre)).Cast <Genre>(); return(Page()); }
/// <summary> /// Add a new movie /// </summary> /// <param name="movieinput"></param> /// <returns></returns> public bool AddMovie(MovieModel movieinput) { return(movieData.AddMovie(movieinput)); }
public MovieDto Add(MovieDto movie) { _movieData.AddMovie(movie); _movieList = _movieData.GetAllMovies(); return(movie); }