예제 #1
0
        public async Task<MovieDirectors> getMovieDirector(int id)
        {
            Uri baseAddress = new Uri("http://api.themoviedb.org/3/");
            MovieDirectors director = new MovieDirectors();

            using (HttpClient httpClient = new HttpClient { BaseAddress = baseAddress })
            {
                httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "application/json");

                using (HttpResponseMessage response = await httpClient.GetAsync("movie/" + id + "/credits?api_key=" + APIKEY))
                {
                    if (response.StatusCode == (HttpStatusCode)200)
                    {
                        string responseData = await response.Content.ReadAsStringAsync();
                        dynamic res = JsonConvert.DeserializeObject(responseData);

                        foreach (dynamic i in res["crew"])
                        {
                            if (i["job"] == "Director")
                            {
                                director.id = i["id"];
                                director.director_name = i["name"];
                            }
                        }

                        return director;
                    }
                }
            }

            return null;
        }
예제 #2
0
        private void getMovieDetails(int movieID)
        {
            cast = new List<MovieCast>();
            sqa = new SQLServerAccess();

            cast = sqa.getMovieCast(this.movieID);

            foreach (MovieCast m in cast)
            {
                string[] row = new string[] { m.name, m.character };
                dgvMovieCredits.Rows.Add(row);
            }

            director = sqa.getMovieDirector(this.movieID);
        }
예제 #3
0
        private async Task getMovieDetails()
        {
            
            cast = new List<MovieCast>();

            API_INIT = new APIAccess();

            cast = await API_INIT.getMovieCredits(movieID);

            foreach (MovieCast m in cast)
            {
                string[] row = new string[] { m.name, m.character };
                dgvMovieCredits.Rows.Add(row);
            }

            director = await API_INIT.getMovieDirector(movieID);
        }