private async Task<Person> DeletePerson(Person person) { using (var cl =BuildClient()) { var response = await cl.PostAsync(personPath, person.BuildPostBody()); if (response.IsSuccessStatusCode) { var sresult = await response.Content.ReadAsStringAsync(); return await response.Content.ReadAsAsync<Person>(); } return null; } }
public async Task<Person> AddPerson(Person person) { using (var cl = BuildClient()) { var body = person.BuildPostBody(); var response = await cl.PostAsync(personPath, body); var sresult = await response.Content.ReadAsStringAsync(); Debug.WriteLine(sresult); if (response.IsSuccessStatusCode) { return await response.Content.ReadAsAsync<Person>(); } else { Debug.WriteLine(response.ReasonPhrase); } return null; } }