Deleting data from webservice xamarin

I have been trying to delete a data using "DeleteAsync" and unfortunately it doesn't show any error neither anything, when i hit delete buttom nothing happens.
and don't no where i miss!

and this the code.
private async void Button_Clicked(object sender, EventArgs e) { var uri = new Uri(string.Format(weburl, txtID.Text)); HttpClient client = new HttpClient(); var result = await client.DeleteAsync(uri); if (result.IsSuccessStatusCode) { await DisplayAlert("Successfully", "you data have been Deleted", "OK"); } }

Answers

  • Ahsan_SiddiqueAhsan_Siddique PKMember ✭✭✭✭

    @abokor_hsan said:
    I have been trying to delete a data using "DeleteAsync" and unfortunately it doesn't show any error neither anything, when i hit delete buttom nothing happens.
    and don't no where i miss!

    and this the code.
    private async void Button_Clicked(object sender, EventArgs e) { var uri = new Uri(string.Format(weburl, txtID.Text)); HttpClient client = new HttpClient(); var result = await client.DeleteAsync(uri); if (result.IsSuccessStatusCode) { await DisplayAlert("Successfully", "you data have been Deleted", "OK"); } }

    Please follow my video for understanding of consuming RESTful services.

    https://c-sharpcorner.com/article/consuming-restful-apis-in-xamarin-android/

    You can forward 15 mint next if you not interested in all methods.

Sign In or Register to comment.