Exemplo n.º 1
0
        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;
            }

        }
Exemplo n.º 2
0
 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;
     }
     
 }