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); }
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>(); } } }