private void btnUpdate_Click(object sender, EventArgs e) { try { var department = new Department { DepartmentId = int.Parse(txtDId.Text), Name = txtName.Text }; var updated = departmentCRUD.UpdateDepartment(department); if (updated) { MessageBox.Show("Department's record updated successfully"); } else { MessageBox.Show("Failed to update record!", "Note", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void UpdateDeparment(Department dataToBeUpdated) { departmentTableActions.UpdateDepartment(dataToBeUpdated); }