Пример #1
0
 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" }));
     }
 }
Пример #2
0
        public MoviesViewModel(NavigationManager navigation, IMovies moviesManager)
        {
            MoviesManager       = moviesManager;
            MyNavigationManager = navigation;

            MoviesCollection = (MoviesManager.GetMovies().GetAwaiter().GetResult()).ToList();
        }
Пример #3
0
        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);
        }
Пример #4
0
        // GET: Home
        public ActionResult Index()
        {
            List <Movie> movieList = movies.GetMovies();

            return(View(movieList));
        }