private async void dgvBarangay_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (listBarangay.Count() != 0) { if (dgvBarangay.Columns[e.ColumnIndex].HeaderText == "Edit") { barangayID = int.Parse(dgvBarangay.CurrentRow.Cells[2].Value.ToString()); EditBarangay = true; frmAddBarangay fab = new frmAddBarangay(); fab.ShowDialog(); } if (dgvBarangay.Columns[e.ColumnIndex].HeaderText == "Delete") { barangayID = int.Parse(dgvBarangay.CurrentRow.Cells[2].Value.ToString()); Barangay barangay = await repository.GetBarangayByIdAsync(barangayID); DialogResult dr = MessageBox.Show("Are you sure to delete Barangay " + barangay.BrgyName + " from list?", "Warning!", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { await repository.DeleteBarangayAsync(barangayID); MessageBox.Show("Delete Successfull!", "Success!"); await LoadBarangay(); } } } }
private void btnCreateBarangay_Click(object sender, EventArgs e) { frmAddBarangay fab = new frmAddBarangay(); fab.ShowDialog(); }