示例#1
0
        public async Task <MovieIndexModel> GetMovie(string id)
        {
            var Movie = await _movieRepo.GetMovieById(id);

            if (Movie == null)
            {
                return(null);
            }

            var MovieModel = new MovieIndexModel {
                Id          = Movie.Id,
                Title       = Movie.Title,
                Description = Movie.Description,
                Picture     = Movie.Picture,
                CategoryId  = Movie.CategoryId,
                Actors      = Movie.Actors.Select(a => new ActorIndexModel {
                    Id           = a.Id,
                    ActorName    = a.ActorName,
                    ActorPicture = a.ActorPicture
                }),
                MovieLink = Movie.MovieLink
            };


            return(MovieModel);
        }
示例#2
0
        public IActionResult Index(int id)
        {
            var movie = _movieService.GetById(id);

            var model = new MovieIndexModel
            {
                Id           = movie.Id,
                Name         = movie.Name,
                ImageUrl     = movie.ImageUrl,
                InStock      = movie.InStock,
                Price        = movie.Price,
                Description  = movie.ShortDescription + "\n" + movie.LongDescription,
                CategoryId   = movie.Category.Id,
                CategoryName = movie.Category.Name
            };

            return(View(model));
        }
        public async Task <IActionResult> Index()
        {
            ICollection <Movie> movieModels = await _movies.GetAllLight();

            var listingResults = movieModels
                                 .Select(result => new MovieIndexListingModel
            {
                Id      = result.Id,
                Rank    = result.Rank,
                Year    = result.Year,
                Title   = result.Title,
                Revenue = result.Revenue
            });

            var model = new MovieIndexModel()
            {
                Movies = listingResults
            };

            return(View(model));
        }
        public IActionResult Index()
        {
            var movieModels = _movies.GetAll();

            var listingResult = movieModels
                                .Select(result => new MovieIndexListingModel
            {
                MovieId    = result.MovieId,
                PosterUrl  = result.PosterUrl,
                Director   = result.Director,
                Title      = result.Title,
                MovieGenre = result.MovieGenres
            });

            var movieListings = new MovieIndexModel()
            {
                Movies = listingResult
            };

            return(View(movieListings));
        }
        public IActionResult Index(int id)
        {
            if (id != 0)
            {
                userId = id;
            }
            var movieModels   = _movies.GetAll();
            var listingResult = movieModels
                                .Select(result => new MovieIndexListingModel
            {
                Id          = result.Id,
                ImageUrl    = result.ImageUrl,
                Name        = result.Name,
                Description = result.Description
            });

            var model = new MovieIndexModel()
            {
                Movies = listingResult
            };
            int i = userId;

            return(View(model));
        }