private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to DELETE a image of bicycle?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes) { var restClient = new RestClient("http://marichely.me:8099/"); var restRequest = new RestRequest("bicycle/picture/id", Method.DELETE) { RequestFormat = DataFormat.Json }; restRequest.AddHeader("UserApiKey", User.ApiKey); restRequest.AddHeader("imageid", PictureId.ToString()); IRestResponse restResponse = restClient.Execute(restRequest); if ((int)restResponse.StatusCode == 200) { MessageBox.Show("You 're sucessfully deleted image!"); } } }