Exemplo n.º 1
0
 public static Uri GetDealServerUri(DealServerQueryModel model)
 {
     var UriString = String.Format(DealServerSettings.BingOffersNearbyDeals, DealServerSettings.DealsDomain,
         model.Latitude,
         model.Longitude, model.Count, DealServerSettings.QueryRadius, DealServerSettings.ClientId, model.Refinement.ConstructRefinementParam());
     return new Uri(UriString);
 }
Exemplo n.º 2
0
 public static async Task<List<DealModel>> GetNearByDeals(DealServerQueryModel model)
 {
     using (var dlClient = new HttpClient())
     {
         var url = ClientUriBuilder.GetDealServerUri(model);
         try
         {
             var responseString = await dlClient.GetStringAsync(url);
             var list = JsonConvert.DeserializeObject<List<DealModel>>(responseString);
             return list;
         }
         catch (JsonException jException)
         {
             return new List<DealModel>();
         }
         catch (Exception e)
         {
             return new List<DealModel>();
         }
     }
 }