コード例 #1
0
 /// <summary>
 /// Queries the data source for restaurant data
 /// </summary>
 ///
 /// <precondition>
 /// none
 /// </precondition>
 /// <postcondition>
 /// this.theManager.Size() != 0 IF there exists api data
 /// this.theManager.Size() == 0 IF there does not exist api data
 /// </postcondition>
 /// <returns>the populated restaurant manager, returns null if the url is not valid</returns>
 public JArray QueryRestaurants(string apiQueryUrl)
 {
     try {
         var client = new WebClient();
         client.Headers.Add("Authorization", "Bearer " + ApiKey.GetApiKey());
         string response = client.DownloadString(apiQueryUrl);
         var    retrievedRestaurantData = (JObject)JsonConvert.DeserializeObject(response);
         return((JArray)retrievedRestaurantData.GetValue("businesses"));
     }
     catch (WebException) {
         return(null);
     }
 }