コード例 #1
0
        /// <summary>
        /// Finds the certification.
        /// </summary>
        /// <param name="movieId">The movie identifier.</param>
        /// <returns></returns>
        public async Task <string> FindCertification(string movieId)
        {
            string url = string.Format("3/movie/{0}/releases?api_key={1}", movieId, MovieHelper.ThemoviedbApiKey);
            MovieCertificationResult result = await _restApiService.Get <MovieCertificationResult>(url);

            return(ConvertCertificationResult(result));
        }
コード例 #2
0
        private string ConvertCertificationResult(MovieCertificationResult result)
        {
            CountryCertification certification = result.Countries.FirstOrDefault(cert => cert.Iso_3166_1 == "US");

            if (certification == null)
            {
                certification = result.Countries.FirstOrDefault();
                if (certification == null)
                {
                    return(null);
                }
            }
            if (string.IsNullOrEmpty(certification.Certification))
            {
                return(null);
            }
            return("Rated " + certification.Certification);
        }
コード例 #3
0
 private string ConvertCertificationResult(MovieCertificationResult result)
 {
     CountryCertification certification = result.Countries.FirstOrDefault(cert => cert.Iso_3166_1 == "US");
     if(certification == null)
     {
         certification = result.Countries.FirstOrDefault();
         if (certification == null)
         {
             return null;
         }
     }
     if (string.IsNullOrEmpty(certification.Certification))
     {
         return null;
     }
     return "Rated " + certification.Certification;
 }