Ejemplo n.º 1
0
        public async Task<string> UpdatePoiAsync(PoiData poiData)
        {
            using (var client = new HttpClient())
            {
                var url = string.Format("{0}/{1}", _url, "update_poi");

                var jsonSerializerSettings = new JsonSerializerSettings
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver(),
                    NullValueHandling = NullValueHandling.Ignore
                };

                var poiStringData = JsonConvert.SerializeObject(poiData, Newtonsoft.Json.Formatting.Indented, jsonSerializerSettings);

                var jsonContent = new StringContent(poiStringData);

                var response = await client.PostAsync(url, jsonContent);

                var content = await response.Content.ReadAsStringAsync();

                return content;
            }
        }
Ejemplo n.º 2
0
        public async Task<AddPoiResponse> AddPoiAsync(PoiData poiData)
        {
            using (var client = new HttpClient())
            {
                var url = string.Format("{0}/{1}", _url, "add_poi");

                var jsonSerializerSettings = new JsonSerializerSettings
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver(),
                    NullValueHandling = NullValueHandling.Ignore
                };

                poiData.Id = null;

                var poiStringData = JsonConvert.SerializeObject(poiData, Newtonsoft.Json.Formatting.Indented, jsonSerializerSettings);

                var jsonContent = new StringContent(poiStringData);

                var response = await client.PostAsync(url, jsonContent);

                var content = await response.Content.ReadAsStringAsync();

                try
                {
                    return JsonConvert.DeserializeObject<AddPoiResponse>(content);
                }
                catch (Exception)
                {
                    throw new Exception(content);
                }
            }
        }
Ejemplo n.º 3
0
 public string UpdatePoi(PoiData poiData)
 {
     return UpdatePoiAsync(poiData).ResultSynchronizer();
 }
Ejemplo n.º 4
0
 public AddPoiResponse AddPoi(PoiData poiData)
 {
     return AddPoiAsync(poiData).ResultSynchronizer();
 }