private void btnAdd_Click(object sender, EventArgs e) { frmEdit editor = new frmEdit(); if (editor.ShowDialog() == DialogResult.OK) { StuDbAccessor.Add(editor.student); this.ViewAllStudent(); } }
private void btnUpdate_Click(object sender, EventArgs e) { Student selStudent = this.GetFirstSelectedStudent(); if (selStudent != null) { frmEdit editor = new frmEdit(selStudent); int oldId = selStudent.ID; if (editor.ShowDialog() == DialogResult.OK) { StuDbAccessor.Update(oldId, selStudent); this.ViewAllStudent(); } } }