public IActionResult AddMovieToList(int movieId, int movieListId) { MovieListModel movieListModel = MovieListModelFromBO(movieListCollection.GetMovieList(movieListId)); MovieListDTO movieListDTO = CreateMovieListDTOFromViewModel(movieListModel); MovieList movieList = new MovieList(movieListDTO); movieList.AddMovieToList(movieListDTO, movieId); return(RedirectToAction("EditMovieList", new { movieListId = movieListId })); }
public IActionResult CreateMovieList(MovieListModel movieListModel, string userName) { int userId = userCollection.GetUserIdByUName(userName); movieListModel.UserId = userId; MovieListDTO movieListDTO = CreateMovieListDTOFromViewModel(movieListModel); MovieList movielist = new MovieList(movieListDTO); int newMovieListId = movieListCollection.CreateMovieList(CreateMovieListDTOFromViewModel(movieListModel)); movieListDTO.Id = newMovieListId; movielist.AddMovieToList(movieListDTO, 3009); return(RedirectToAction("Index", "MovieList", new { userName = userName })); }
public void Sort_Name_True() //sorts are all the same except for different fields { MovieList movieList = new MovieList(); List <Movie> movies = new List <Movie>(); movieList.InitializeMovieList(); movieList.AddMovieToList("Pulp Fiction", "Samuel Jackson", "Crime", "Quentin Tarantino"); movieList.MovieSortByName(); movies = movieList.ReturnMovieList(); Assert.Equal("Die Hard", movies[0].MovieName); }