private void btnDodaj_Click(object sender, EventArgs e) { using (FormDodajEdytujFirme frmDEF = new FormDodajEdytujFirme(null, db)) { if (frmDEF.ShowDialog() == DialogResult.OK) { FirmyBindingSource.DataSource = db.FIRMY.ToList(); db.SaveChanges(); FirmyBindingSource.MoveLast(); } } }
private void btnEdytuj_Click(object sender, EventArgs e) { if (FirmyBindingSource == null) { return; } using (FormDodajEdytujFirme frmDEF = new FormDodajEdytujFirme(FirmyBindingSource.Current as FIRMY, db)) { if (frmDEF.ShowDialog() == DialogResult.OK) { FirmyBindingSource.DataSource = db.FIRMY.ToList(); db.Entry(FirmyBindingSource.Current as FIRMY).State = EntityState.Modified; db.SaveChanges(); } } }