Beispiel #1
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         ListViewItem item = listView1.SelectedItems[0];
         string       id   = item.Text;
         Ogrenciler   ogr  = context.tablo.Find(Convert.ToInt32(id));
         context.Entry(ogr).State = EntityState.Deleted;
         context.SaveChanges();
         MessageBox.Show("Silindi");
         btnGoruntule.PerformClick();
     }
 }
Beispiel #2
0
 private void btnGuncelle_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         ListViewItem item = listView1.SelectedItems[0];
         string       id   = item.Text;
         Ogrenciler   ogr  = context.tablo.Find(Convert.ToInt32(id));
         txtBoxAd.Text     = ogr.Ad;
         txtBoxSoyad.Text  = ogr.Soyad;
         txtBoxOkulNo.Text = ogr.OgrenciNo;
         btnKaydet.Text    = "Güncelle";
         ogrenci           = ogr;
     }
     else
     {
         MessageBox.Show("Listeden veri seçilmedi!");
     }
 }
Beispiel #3
0
 public bbtn()
 {
     InitializeComponent();
     context = new OgrencilerContext();
     ogrenci = new Ogrenciler();
 }