Пример #1
0
 private void button1_Click(object sender, EventArgs e)
 {//Ekle
     if (textBox1.Text != null && numericUpDown1.Text != null)
     {
         Urun u = new Urun();
         u.UrunAdi = textBox1.Text;
         u.Fiyat   = numericUpDown1.Value;
         db.Urunler.Add(u);
     }
     db.SaveChanges();
     ListboxYenile();
 }
Пример #2
0
        private void button3_Click(object sender, EventArgs e)
        {//odemeButonu
            Siparis siparis = new Siparis();

            siparis.KaydedenKullaniciID = 1;
            siparis.SiparistekiUrunler  = new List <SiparisDetay>();
            foreach (Sepet item in sepet)
            {
                SiparisDetay sd = new SiparisDetay();
                sd.Miktar = item.Miktar;
                sd.Tutar  = item.ToplamFiyat;
                sd.UrunID = item.UrunID;
                siparis.SiparistekiUrunler.Add(sd);
            }
            db.Siparisler.Add(siparis);
            db.SaveChanges();
            button2.PerformClick();//temizle butonuna tıkla demek
        }