public async Task <ActionResult> DeleteCategory(int id) { var response = await _categoryApiClient.DeleteAsync(id); string result = await response.Content.ReadAsStringAsync(); switch ((int)response.StatusCode) { case (int)HttpStatusCode.OK: return(Json(new { Success = true }, JsonRequestBehavior.AllowGet)); case (int)HttpStatusCode.NotFound: return(HttpNotFound()); default: return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } }
private void btnRemove_ClickAsync(object sender, EventArgs e) { foreach (DataGridViewRow row in dgvEmploye.SelectedRows) { try { int id = Convert.ToInt32(row.Cells[0].Value.ToString()); _categoryApiClient.DeleteAsync(id); CetegoriesRead(); //var response =await _categoryApiClient.DeleteAsync(id); //string result =await response.Content.ReadAsStringAsync(); } catch (Exception ex) { throw; } } CetegoriesRead(); }