private void button2_Click(object sender, EventArgs e) { int id = (int)textBox2.Tag; UreticiFirmalar sil = baglanti.UreticiFirmalarSet.SingleOrDefault(c => c.uretici_id == id); baglanti.UreticiFirmalarSet.Remove(sil); baglanti.SaveChanges(); dataGridView1.DataSource = baglanti.UreticiFirmalarSet.ToList(); Temizle(); }
private void button1_Click(object sender, EventArgs e) { UreticiFirmalar ekle = new UreticiFirmalar(); ekle.UFirmaAdi = textBox2.Text; ekle.UFirmaAdres = textBox3.Text; ekle.UFirmaTel = maskedTextBox1.Text; ekle.Firmalar_firma_id = 1; baglanti.UreticiFirmalarSet.Add(ekle); baglanti.SaveChanges(); dataGridView1.DataSource = baglanti.UreticiFirmalarSet.ToList(); Temizle(); }
private void button4_Click(object sender, EventArgs e) { int id = (int)textBox2.Tag; UreticiFirmalar yenile = baglanti.UreticiFirmalarSet.SingleOrDefault(g => g.uretici_id == id); yenile.UFirmaAdi = textBox2.Text; yenile.UFirmaAdres = textBox3.Text; yenile.UFirmaTel = maskedTextBox1.Text; yenile.Firmalar_firma_id = 1; baglanti.SaveChanges(); dataGridView1.DataSource = baglanti.UreticiFirmalarSet.ToList(); Temizle(); }