Ejemplo n.º 1
0
        private SeriesStatistics MapSeriesStatistics(List <SeasonStatistics> seasonStatistics)
        {
            var seriesStatistics = new SeriesStatistics
            {
                SeasonStatistics  = seasonStatistics,
                SeriesId          = seasonStatistics.First().SeriesId,
                EpisodeFileCount  = seasonStatistics.Sum(s => s.EpisodeFileCount),
                EpisodeCount      = seasonStatistics.Sum(s => s.EpisodeCount),
                TotalEpisodeCount = seasonStatistics.Sum(s => s.TotalEpisodeCount),
                SizeOnDisk        = seasonStatistics.Sum(s => s.SizeOnDisk)
            };

            var nextAiring = seasonStatistics.Where(s => s.NextAiring != null)
                             .OrderBy(s => s.NextAiring)
                             .FirstOrDefault();

            var previousAiring = seasonStatistics.Where(s => s.PreviousAiring != null)
                                 .OrderBy(s => s.PreviousAiring)
                                 .LastOrDefault();

            seriesStatistics.NextAiringString     = nextAiring != null ? nextAiring.NextAiringString : null;
            seriesStatistics.PreviousAiringString = previousAiring != null ? previousAiring.PreviousAiringString : null;

            return(seriesStatistics);
        }
Ejemplo n.º 2
0
        private SeriesStatistics MapSeriesStatistics(List<SeasonStatistics> seasonStatistics)
        {
            var seriesStatistics = new SeriesStatistics
                                   {
                                       SeasonStatistics = seasonStatistics,
                                       SeriesId = seasonStatistics.First().SeriesId,
                                       EpisodeFileCount = seasonStatistics.Sum(s => s.EpisodeFileCount),
                                       EpisodeCount = seasonStatistics.Sum(s => s.EpisodeCount),
                                       TotalEpisodeCount = seasonStatistics.Sum(s => s.TotalEpisodeCount),
                                       SizeOnDisk = seasonStatistics.Sum(s => s.SizeOnDisk)
                                   };

            var nextAiring = seasonStatistics.Where(s => s.NextAiring != null)
                                             .OrderBy(s => s.NextAiring)
                                             .FirstOrDefault();

            var previousAiring = seasonStatistics.Where(s => s.PreviousAiring != null)
                                                 .OrderBy(s => s.PreviousAiring)
                                                 .LastOrDefault();

            seriesStatistics.NextAiringString = nextAiring != null ? nextAiring.NextAiringString : null;
            seriesStatistics.PreviousAiringString = previousAiring != null ? previousAiring.PreviousAiringString : null;

            return seriesStatistics;
        }