private void btnDelete_Click(object sender, EventArgs e) { if (dgvSelect.SelectedRows.Count > 0) { string bid = dgvSelect.SelectedRows[0].Cells[0].Value.ToString(); int cnt = BrandManager.DeleteBrand(bid); ReFresh(); } else { MessageBox.Show("请先选中要删除的行"); } }
public IHttpActionResult DeleteBrand(int brandId) { BrandManager brandManager = new BrandManager(); string message; var brand = new BrandDto { Id = brandId }; if (brandManager.IsValid(MethodTypes.Delete, brand, out message)) { if (brandManager.DeleteBrand(brand, out message)) { return(Ok()); } } ; return(BadRequest(message)); }