Ejemplo n.º 1
0
        public async Task <IActionResult> Detail(int?id)
        {
            Movie movie = await showService.GetMovieDetails(id, _context, webRequest);

            var user = await GetCurrentUserAsync();

            MyListShows myListShow = null;
            bool        isLoggedIn = true;
            bool        isInList   = false;

            if (user == null)
            {
                isLoggedIn = false;
                myListShow = null;
            }
            else
            {
                myListShow = await _context.MyListShows
                             .Include(x => x.MyList)
                             .Where(x => x.MyList.User.Id == user.Id)
                             .SingleOrDefaultAsync(x => x.SafeCompareId(movie.ID));

                isInList = myListShow == null ? false : true;
            }

            var vm = new DetailMovieViewModel()
            {
                Movie      = movie,
                MyListShow = myListShow,
                IsLoggedIn = isLoggedIn,
                IsInList   = isInList
            };

            return(View(vm));
        }
Ejemplo n.º 2
0
        private async void OnFilmSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var filmSelected = e.SelectedItem as InformationMovie;

            var movieViewModel = new DetailMovieViewModel(filmSelected.IdMovie);

            await Navigation.PushAsync(new MovieDetail(movieViewModel));
        }
Ejemplo n.º 3
0
        public ActionResult Details(int id)
        {
            //get movie detail from DB, with Include which links the Genre table / object
            var movieDetail = new DetailMovieViewModel()
            {
                Movie = _dbContext.Movies.Include(c => c.MovieGenre).SingleOrDefault(customer => customer.Id == id)
            };

            return(View(movieDetail));
        }
        public IActionResult DetailMovie(int id)
        {
            Movie movieFromDb = _applicationDbContext.Movies
                                .Include(x => x.Genre)
                                .ThenInclude(x => x.MovieGenre)
                                .SingleOrDefault(x => x.Id == id);

            List <MovieGenreTagDetailViewModel> tags = new List <MovieGenreTagDetailViewModel>();

            foreach (var item in movieFromDb.Genre.Select(x => x.MovieGenre))
            {
                var tagDb = new MovieGenreTagDetailViewModel()
                {
                    Name = item.Name
                };

                tags.Add(tagDb);
            }

            DetailMovieViewModel detailMovie = new DetailMovieViewModel()
            {
                Id                   = movieFromDb.Id,
                Title                = movieFromDb.Title,
                Cover                = movieFromDb.Cover,
                Releas               = movieFromDb.Releas,
                Director             = movieFromDb.Director,
                Description          = movieFromDb.Description,
                Duration             = movieFromDb.Duration,
                UrlTrailer           = movieFromDb.UrlTrailer,
                MovieGenreTagDetails = tags
            };



            List <MovieReview> reviews = _applicationDbContext.MovieReviews.Where(x => x.MovieId == id).ToList();

            List <MovieReviewViewModel> reviewList = new List <MovieReviewViewModel>();

            foreach (var item in reviews)
            {
                var user = _applicationDbContext.Users.FirstOrDefault(x => x.Id == item.UserId);
                reviewList.Add(new MovieReviewViewModel()
                {
                    UserName = user.UserName,
                    Rating   = item.Rating,
                    Review   = item.Review
                });
            }
            detailMovie.MovieReviews = reviewList;



            return(View(detailMovie));
        }
Ejemplo n.º 5
0
        public DetailMovieView()
        {
            InitializeComponent();

            Movie movie = new Movie()
            {
                Title    = "Back to the Future",
                Year     = "1985",
                Rated    = "PG",
                Released = "03 Jul 1985",
                Runtime  = "116 min",
                Genre    = "Adventure, Comedy, Sci-Fi",
                Director = "Robert Zemeckis",
                Writer   = "Robert Zemeckis, Bob Gale",
                Actors   = "Michael J. Fox, Christopher Lloyd, Lea Thompson, Crispin Glover",
                Plot     = "Marty McFly, a 17-year-old high school student, is accidentally sent thirty years into the past in a time-traveling DeLorean invented by his close friend, the maverick scientist Doc Brown.",
                Language = "English",
                Country  = "USA",
                Awards   = "Won 1 Oscar. Another 19 wins & 25 nominations.",
                Website  = "http://www.bttfmovie.com/",
                Poster   = "https://ia.media-imdb.com/images/M/MV5BZmU0M2Y1OGUtZjIxNi00ZjBkLTg1MjgtOWIyNThiZWIwYjRiXkEyXkFqcGdeQXVyMTQxNzMzNDI@._V1_SX300.jpg",
                Ratings  = new List <Rating>()
                {
                    new Rating()
                    {
                        Source = "Internet Movie Database", Value = "8.5/10"
                    },
                    new Rating()
                    {
                        Source = "Rotten Tomatoes", Value = "96%"
                    },
                    new Rating()
                    {
                        Source = "Metacritic", Value = "86/100"
                    },
                }
            };

            BindingContext = new DetailMovieViewModel(movie);
        }
Ejemplo n.º 6
0
 public DetailMovieView(Movie movie) : this()
 {
     BindingContext = new DetailMovieViewModel(movie);
 }
Ejemplo n.º 7
0
 public MovieDetail(DetailMovieViewModel viewModel)
 {
     InitializeComponent();
     _viewModel     = viewModel;
     BindingContext = viewModel;
 }
Ejemplo n.º 8
0
        public DetailMovieView()
        {
            InitializeComponent();

            BindingContext = new DetailMovieViewModel();
        }