private void BtnAddForenty_Click(object sender, EventArgs e) { using (var forms = new frmLivrosAdd(null, new LivrosRepository(new BiblioteContext()), new AutorRepositoty(new BiblioteContext()), new EditoraRepository(new BiblioteContext()))) { var usercontrol = OpenFormsDialog.ShowForm(null, forms); if (usercontrol == DialogResult.OK) { Loader(); } } }
private void MenuEditar_Click(object sender, System.EventArgs e) { if (gridView1.FocusedRowHandle >= 0 || gridView1.SelectedRowsCount > 0) { using (var forms = new frmLivrosAdd( livrosModelsBindingSource.Current as LivrosModels, new LivrosRepository(new BiblioteContext()), new AutorRepositoty(new BiblioteContext()), new EditoraRepository(new BiblioteContext()))) { var usercontrol = OpenFormsDialog.ShowForm(null, forms); if (usercontrol == DialogResult.OK) { Loader(); } } } }