private void grvBrand_CellClick(object sender, DataGridViewCellEventArgs e) { // Ignore clicks that are not in our try { if (e.ColumnIndex == grvBrand.Columns["Delete"].Index && e.RowIndex >= 0) { int numberRow = Convert.ToInt32(e.RowIndex); //assign the value plus the desired column example 1 ID = Convert.ToInt32(grvBrand.Rows[numberRow].Cells[0].Value.ToString()); if (_IBrand.Delete(ID) > 0) { MessageBox.Show("Operation Success"); Reset(); } } if (e.ColumnIndex == grvBrand.Columns["Edit"].Index && e.RowIndex >= 0) { int numberRow = Convert.ToInt32(e.RowIndex); //assign the value plus the desired column example 1 ID = Convert.ToInt32(grvBrand.Rows[numberRow].Cells[0].Value.ToString()); txtBrand.Text = Convert.ToString(grvBrand.Rows[numberRow].Cells[2].Value); txtBrndDescription.Text = Convert.ToString(grvBrand.Rows[numberRow].Cells[3].Value); btnSave.Text = "Update"; } } catch (Exception ex) { lblMessageBox.Text = ex.ToString(); lblMessageBox.Enabled = true; lblMessageBox.ForeColor = Color.Red; } }
/// <summary> /// 删除对应数据 /// </summary> /// <param name="Id"></param> /// <returns></returns> public int Delete(object Id) { return(dal.Delete(Id)); }
public async Task <ResponseViewModel <BrandViewModel> > Delete([FromBody] BrandViewModel BrandObj) { return(await brandMethod.Delete(BrandObj)); }
public bool Delete(string ID) { return(dal.Delete(ID)); }