private void NewEmployee_Click(object sender, EventArgs e) { var edit = new EmployeeCreateEdit(); if (edit.ShowDialog() == DialogResult.OK) { using (var context = new ApplicationDBContext()) { context.AddEmployee(edit.Employee); UpdateView(); } } }
private void EditButton_Click(object sender, EventArgs e) { var edit = new EmployeeCreateEdit(Employee); if (edit.ShowDialog() == DialogResult.OK) { using (var context = new ApplicationDBContext()) { context.EditEmployee(edit.Employee); } Employee = edit.Employee; this.Close(); } }