public static string Put(string url, QuadernoBase obj) { using (HttpResponseMessage response = CLIENT.PutAsJsonAsync( url, obj).Result) { response.EnsureSuccessStatusCode(); return(response.Content.ReadAsStringAsync().Result); } }
public static string Post(string url, QuadernoBase obj) { string jsonObj = JsonConvert.SerializeObject(obj); using (HttpResponseMessage response = CLIENT.PostAsJsonAsync( url, obj).Result) { response.EnsureSuccessStatusCode(); string result = response.Content.ReadAsStringAsync().Result; var responseObj = JsonConvert.DeserializeObject <QuadernoBase>(result); obj.Id = responseObj.Id; return(result); } }