public IActionResult GetMovies([FromQuery] int page, [FromQuery] int pageSize, [FromQuery] String genreId, [FromQuery] String search) { try { List <Movies> moviesList; if (string.IsNullOrWhiteSpace(search)) { if (string.IsNullOrWhiteSpace(genreId)) { moviesList = _movies.GetMovies(page, pageSize); } else { moviesList = _movies.GetMoviesByGenre(page, pageSize, genreId); } } else { moviesList = _movies.SearchMovies(page, pageSize, search); } return(new JsonResult(new { StatusCodeResult = "200", movies = moviesList })); } catch (Exception) { return(new JsonResult(new { StatusCodeResult = "500", message = "Server error" })); } }
public MoviesViewModel(NavigationManager navigation, IMovies moviesManager) { MoviesManager = moviesManager; MyNavigationManager = navigation; MoviesCollection = (MoviesManager.GetMovies().GetAwaiter().GetResult()).ToList(); }
public async Task <IEnumerable <InformationMovie> > GetInformationVideo() { List <InformationMovie> retourMovies = new List <InformationMovie>(); var temp = await _moviesManager.GetMovies(); foreach (MovieModel item in temp) { InformationMovie movie = new InformationMovie() { IdMovie = item.Id, Titre = item.MovieInformation.Titre, DateAdded = item.DateAdded, PosterPath = item.MovieTmDb.PosterPath, }; retourMovies.Add(movie); } return(retourMovies); }
// GET: Home public ActionResult Index() { List <Movie> movieList = movies.GetMovies(); return(View(movieList)); }