Exemplo n.º 1
0
 public async Task<int> DeletePersonAsync(PersonVM personVM) {
     using (HttpClientHandler handler = new HttpClientHandler { CookieContainer = new CookieContainer() }) {
         using (var httpClient = new HttpClient()) {
             var response = await httpClient.PutAsJsonAsync<PersonVM>(personBaseUri, personVM);
             await response.EnsureSuccessWithValidationSupportAsync();
             var numRowsAffected = await response.Content.ReadAsAsync<int>();
             return numRowsAffected;
         }
     }
 }
Exemplo n.º 2
0
        public async Task<int> EditPersonAsync(PersonVM personVM) {
            using (HttpClientHandler handler = new HttpClientHandler { CookieContainer = new CookieContainer() }) {
                using (var httpClient = new HttpClient()) {

                    // just for testing WebAPI.ProductController ModelState.IsValid
                    //product.Name = "123";

                    var response = await httpClient.PutAsJsonAsync<PersonVM>(personBaseUri, personVM);
                    await response.EnsureSuccessWithValidationSupportAsync();
                    var numRowsAffected = await response.Content.ReadAsAsync<int>();
                    return numRowsAffected;
                }
            }
        }
Exemplo n.º 3
0
 // Add AppBarButton
 private void AddPerson() {
     SelectedPersonVM = new PersonVM();
     navigationService.Navigate("AddPerson", SelectedPersonVM);
 }
Exemplo n.º 4
0
 public async Task<int> DeletePersonAsync(PersonVM personVM) {
     int numRowsAffected = await personServiceProxy.DeletePersonAsync(personVM);
     return numRowsAffected;
 }