Exemple #1
0
        private void btnguncelle_Click(object sender, EventArgs e)
        {
            menu m = db.menu.Where(x => x.menuID == menuid).SingleOrDefault();
            Urun u = db.Urun.Where(x => x.urunID == urunid).SingleOrDefault();

            u.urunID     = (int)cmburunadi.SelectedValue;
            m.menuAdi    = txtmenuadi.Text;
            m.menuFiyati = Convert.ToDecimal(txtmfiyat.Text);

            db.SaveChanges();
            GridGuncelle();
        }
Exemple #2
0
        private void btnsil_Click(object sender, EventArgs e)
        {
            int id = 0;

            id = (int)gridmenu.CurrentRow.Cells["menuID"].Value;
            menu         m     = db.menu.Where(mst => id == mst.menuID).SingleOrDefault();
            DialogResult deger = MessageBox.Show(m.menuAdi + "  adlı menü silinsin mi?", "Ürün Silme Onayı", MessageBoxButtons.OKCancel);

            if (deger == DialogResult.OK)
            {
                db.menu.Remove(m);
                db.SaveChanges();
                MessageBox.Show(m.menuAdi + " " + "adlı menü silindi. ");


                GridGuncelle();
            }

            else
            {
                MessageBox.Show("İşlem Onaylanmadı");
            }
            GridGuncelle();
        }