private Movie ConvertTMDDResultToModelForTV(TMDBMovie tmdb, int seasonNumber) { var movie = new Movie { Title = tmdb.name, Director = string.Join(", ", tmdb.created_by.Select(x => x.name).ToList()), Distributor = tmdb.production_companies?.FirstOrDefault()?.name, Genre = string.Join(", ", tmdb.genres.Select(x => x.name).ToList()), ImageUrl = string.Format("https://image.tmdb.org/t/p/w500{0}", tmdb.poster_path), Language = tmdb.original_language, TMDBID = tmdb.id, YearReleased = DateTime.Parse(tmdb.first_air_date).Year, }; if (seasonNumber > 0 && tmdb.seasons.SingleOrDefault(x => x.season_number == seasonNumber) != null) { var season = tmdb.seasons.SingleOrDefault(x => x.season_number == seasonNumber); movie.Title += $" Season {seasonNumber}"; movie.SeasonNumber = seasonNumber; movie.TMDBID = season.id; movie.YearReleased = Convert.ToDateTime(season.air_date).Year; movie.ImageUrl = string.Format("https://image.tmdb.org/t/p/w500{0}", season.poster_path); } return(movie); }
private Movie ConvertTMDDResultToModelForMovie(TMDBMovie tmdb) { var movie = new Movie { Title = tmdb.title, Distributor = tmdb.production_companies.First().name, Genre = string.Join(", ", tmdb.genres.Select(x => x.name).ToList()), ImageUrl = string.Format("https://image.tmdb.org/t/p/w500{0}", tmdb.poster_path), Language = tmdb.original_language, TMDBID = tmdb.id, YearReleased = DateTime.Parse(tmdb.release_date).Year, SeasonNumber = 0 }; return(movie); }