private void btn_sil_Click(object sender, EventArgs e) { // FREMEWORK İLE ÖĞRENCİ SİLME Remove Metodu Db_sinavEntities db = new Db_sinavEntities(); int a = Convert.ToInt32(txt_ogrenci_id.Text); var x = db.tbl_ogrenciler.Find(a); db.tbl_ogrenciler.Remove(x); db.SaveChanges(); // DEĞİŞİKLİKLERİ KAYDET MessageBox.Show("ÖĞRENCİ SİLİNDİ"); }
private void btn_kaydet_Click(object sender, EventArgs e) { // FREMEWORK İLE ÖĞRENCİ EKLEME Db_sinavEntities db = new Db_sinavEntities(); tbl_ogrenciler t = new tbl_ogrenciler(); t.ogrenci_ad = txt_ogrenci_ad.Text; t.ogrenci_soyad = txt_ogrenci_soyad.Text; db.tbl_ogrenciler.Add(t); db.SaveChanges(); // DEĞİŞİKLİKLERİ KAYDET MessageBox.Show("öğrenci listeye eklenmiştir"); }
private void btn_guncelle_Click(object sender, EventArgs e) { // FREMEWORK İLE ÖĞRENCİ GÜNCELLEME Db_sinavEntities db = new Db_sinavEntities(); int a = Convert.ToInt32(txt_ogrenci_id.Text); var x = db.tbl_ogrenciler.Find(a); x.ogrenci_ad = txt_ogrenci_ad.Text; x.ogrenci_soyad = txt_ogrenci_soyad.Text; x.ogrenci_foto = txt_ogrenci_foto.Text; db.SaveChanges(); // DEĞİŞİKLİKLERİ KAYDET MessageBox.Show("öğrenci bilgileri güncellendi"); }