コード例 #1
0
        public ViewResult Details(string Slug, int SeasonNumber, int EpisodeNumber)
        {
            var series  = _context.Series.Include(fig => fig.FilmItemGenres).ThenInclude(g => g.Genre).FirstOrDefault(s => s.Slug == Slug);
            var season  = _context.Seasons.Where(srs => srs.SeriesId == series.Id).Where(s => s.Season_SeasonNumber == SeasonNumber).FirstOrDefault();
            var episode = _context.Episodes.Include(mr => mr.UserRatings)
                          .Include(r => r.Reviews)
                          .Include(m => m.Media)
                          .Include(v => v.Videos)
                          .Include(p => p.Photos)
                          .Include(l => l.ListItems).ThenInclude(l => l.List)
                          .Where(s => s.SeasonId == season.Id)
                          .Where(ep => ep.Episode_EpisodeNumber == EpisodeNumber)
                          .FirstOrDefault();

            EpisodeDetailsViewModel episodeDetailsViewModel = new EpisodeDetailsViewModel
            {
                Episode       = episode,
                Genres        = series.FilmItemGenres.Select(g => g.Genre.Name).OrderBy(g => g).ToArray(),
                SeriesName    = series.Name,
                SeasonName    = season.Name,
                EpisodeCount  = season.Season_EpisodeCount,
                CommentCount  = episode.Reviews.Count,
                ListCount     = episode.ListItems.Select(l => l.List).ToList().Count,
                EpisodeNumber = GetEpisodeNumberString(episode)
            };

            return(View(episodeDetailsViewModel));
        }
コード例 #2
0
 public EpisodeDetailsPage(MEpisode episode)
 {
     InitializeComponent();
     BindingContext = EpisodeDetailsVM = new EpisodeDetailsViewModel {
         Episode = episode
     };
     EpisodeDetailsVM.CheckRelation();
 }
コード例 #3
0
        public ViewResult Edit(string Slug, int SeasonNumber, int EpisodeNumber)
        {
            var series  = _context.Series.FirstOrDefault(m => m.Slug == Slug);
            var season  = _context.Seasons.Where(s => s.SeriesId == series.Id).Where(s => s.Season_SeasonNumber == SeasonNumber).FirstOrDefault();
            var episode = _context.Episodes.Where(e => e.SeasonId == season.Id).Where(e => e.Episode_EpisodeNumber == EpisodeNumber).FirstOrDefault();

            EpisodeDetailsViewModel episodeEditViewModel = new EpisodeDetailsViewModel
            {
                Episode       = episode,
                SeasonName    = season.Name,
                SeriesName    = series.Name,
                EpisodeCount  = season.Season_EpisodeCount,
                EpisodeNumber = GetEpisodeNumberString(episode)
            };

            return(View(episodeEditViewModel));
        }