コード例 #1
0
        public IActionResult Index()
        {
            IEnumerable <Movie>     movies           = _unitOfWork.Movie.GetMovies();
            IEnumerable <Screening> playingNowMovies = _unitOfWork.Screening.GetAll().GroupBy(m => m.MovieId).Select(s => s.First());

            Console.WriteLine(playingNowMovies.Count());
            PlayingNowVM playingNowVM = new PlayingNowVM(playingNowMovies, _unitOfWork.Genre.GetGenreList(_unitOfWork.Genre.GetAll()));

            return(View("Index", playingNowVM));
        }
コード例 #2
0
        public PartialViewResult Sort([FromQuery] string genreId)
        {
            if (String.IsNullOrEmpty(genreId) || genreId == "-1")
            {
                IEnumerable <Movie>     movies      = _unitOfWork.Movie.GetMovies();
                IEnumerable <Screening> plNowMovies = _unitOfWork.Screening.GetAll().GroupBy(m => m.MovieId).Select(s => s.First());
                PlayingNowVM            plNowVM     = new PlayingNowVM(plNowMovies, _unitOfWork.Genre.GetGenreList(_unitOfWork.Genre.GetAll()));

                return(PartialView("_PlayingNowMovies", plNowVM));
            }
            var genre = _unitOfWork.Genre.Get(int.Parse(genreId));

            IEnumerable <Screening> playingNowMovies = _unitOfWork.Screening.GetScreeningsWithGenre(genre).GroupBy(m => m.MovieId).Select(s => s.First());
            PlayingNowVM            playingNowVM     = new PlayingNowVM(playingNowMovies, _unitOfWork.Genre.GetGenreList(_unitOfWork.Genre.GetAll()));

            return(PartialView("_PlayingNowMovies", playingNowVM));
        }