private void btnAdd_Click(object sender, EventArgs e) { FrmBrand frmBrand = new FrmBrand(); frmBrand.ShowDialog(); FillDataGridViewBrandsAsync(); }
private void btnUpdateBrand_Click(object sender, EventArgs e) { if (dgvBrands.SelectedRows.Count > 0) { int idSelectedBrand = Convert.ToInt32(dgvBrands.SelectedRows[0].Cells[0].Value); IRepositoryGeneric <Brand> repositoryBrand = new RepositoryBrand(); Brand brandToBeChanged = repositoryBrand.SelectById(idSelectedBrand); FrmBrand frmBrand = new FrmBrand(brandToBeChanged); frmBrand.ShowDialog(); FillDataGridViewBrandsAsync(); FillDataGridViewProducsAsync(); } else { MessageBox.Show("Please select one brand first.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }