Example #1
0
 public List <FacebookApiResponseModel> GetAllPhotoList()
 {
     using (var httpClient = httpClientService.CreateHttpClient())
     {
         var allPhotoList = new List <FacebookApiResponseModel>();
         Args.ApiUrl = string.Concat(FacebookConstant.URL_GET_ALBUM.Replace("{{ALBUMID}}", Args.AlbumId), "&access_token=", Args.AccessToken);
         while (Args.ApiUrl != null)
         {
             var responseData = httpClient.GetAsync(Args.ApiUrl).Result;
             if (responseData.IsSuccessStatusCode)
             {
                 var rawResult  = responseData.Content.ReadAsStringAsync().Result;
                 var jsonResult = JsonConvert.DeserializeObject <FacebookApiResponseModel>(rawResult);
                 allPhotoList.Add(jsonResult);
                 SetNextApiPageToArgument(jsonResult);
             }
             else
             {
                 throw new BusinessException(responseData.ReasonPhrase);
             }
         }
         return(allPhotoList);
     }
 }