private async void mtrBtnEkle_Click(object sender, EventArgs e) { using (FormMusteriEkleDuzenle frm = new FormMusteriEkleDuzenle(new Musteriler())) { if (frm.ShowDialog() == DialogResult.OK) { try { musterilerBindingSource.Add(frm.MusteriBilgi); db.Musteriler.Add(frm.MusteriBilgi); await db.SaveChangesAsync(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Mesaj", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private async void mtrBtnDuzenle_Click(object sender, EventArgs e) { Musteriler obj = musterilerBindingSource.Current as Musteriler; if (obj != null) { using (FormMusteriEkleDuzenle frm = new FormMusteriEkleDuzenle(obj)) { if (frm.ShowDialog() == DialogResult.OK) { try { musterilerBindingSource.EndEdit(); await db.SaveChangesAsync(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Mesaj", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }