private void btnUpdate_Click(object sender, EventArgs e) { try { var department = cbDepartment.SelectedItem as Department; Course course = new Course { CourseId = int.Parse(txtCId.Text), Title = txtTitle.Text, CreditHours = int.Parse(txtCreditHours.Text), DepartmentId = department.DepartmentId }; bool updated = courseCRUD.UpdateCourse(course); if (updated) { MessageBox.Show("Record updated successfully."); } else { MessageBox.Show("Error while updating Record!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void UpdateCourse(Course dataToBeUpdated) { courseTableActions.UpdateCourse(dataToBeUpdated); }