Exemple #1
0
        public IActionResult Index()
        {
            MovieListingModel     movieListingModel = new MovieListingModel(_movies);
            MovieListingViewModel pageData          = movieListingModel.GetData();

            return(View(pageData));
        }
Exemple #2
0
        public MovieListingViewModel GetData()
        {
            MovieListingViewModel pageData = new MovieListingViewModel();

            pageData.Title  = "Movie Listing";
            pageData.Movies = _movies.GetAllMovies();

            return(pageData);
        }
Exemple #3
0
        public IActionResult Index()
        {
            var moviesListing = _movieDbService.GetAll().OrderByDescending(x => x.Id);

            var listingResult = moviesListing
                                .Select(result => new MovieViewModel
            {
                Id                = result.Id,
                MovieName         = result.Name,
                PosterUrl         = result.PosterUrl,
                Plot              = result.Plot,
                ReleaseYear       = result.ReleaseYear,
                CurrentProducerId = result.Producer?.Id ?? 0,
                ProducerName      = result.Producer?.FullName,
                MovieActors       = result.Actors.ToList()
            });

            var model = new MovieListingViewModel()
            {
                Movies = listingResult
            };

            return(View(model));
        }