Example #1
0
 /// <summary>
 /// Gets a movie by the movie database id.
 /// </summary>
 /// <param name="movieId">Id of the movie</param>
 /// <param name="extra">Indicates which parts should be prefetched.</param>
 /// <returns>The specified movie.</returns>
 public static async Task<Movie> GetMovieAsync(int movieId, MovieExtras extra = 0)
 {
     var movie = DatabaseCache.GetObject<Movie>(movieId);
     if (movie == null)
     {
         var request = new Request<Movie>("movie/" + movieId);
         if (!string.IsNullOrEmpty(Language))
             request.AddParameter("language", Language);
         if (extra != 0)
         {
             request.AddParameter("append_to_response", extra.ToString().Replace(" ", ""));
         }
         movie = await request.ProcesRequestAsync();
         DatabaseCache.SetObject(movieId, movie);
     }
     return movie;
 }
        /// <summary>
        /// Gets a movie by the movie database id.
        /// </summary>
        /// <param name="movieId">Id of the movie</param>
        /// <param name="extra">Indicates which parts should be prefetched.</param>
        /// <returns>The specified movie.</returns>
        public static async Task <Movie> GetMovieAsync(int movieId, MovieExtras extra = 0)
        {
            var movie = DatabaseCache.GetObject <Movie>(movieId);

            if (movie == null)
            {
                var request = new Request <Movie>("movie/" + movieId);
                if (!string.IsNullOrEmpty(Language))
                {
                    request.AddParameter("language", Language);
                }
                if (extra != 0)
                {
                    request.AddParameter("append_to_response", extra.ToString().Replace(" ", ""));
                }
                movie = await request.ProcesRequestAsync();

                DatabaseCache.SetObject(movieId, movie);
            }
            return(movie);
        }