private void NewService_Click(object sender, EventArgs e) { var edit = new ServiceCreateEdit(); if (edit.ShowDialog() == DialogResult.OK) { using (var context = new ApplicationDBContext()) { context.AddService(edit.Service); UpdateView(); } } }
private void EditButton_Click(object sender, EventArgs e) { var edit = new ServiceCreateEdit(Service); if (edit.ShowDialog() == DialogResult.OK) { using (var context = new ApplicationDBContext()) { context.EditService(edit.Service); } Service = edit.Service; this.Close(); } }