Esempio n. 1
0
        private void btnRemoveMenu_Click(object sender, EventArgs e)
        {
            int slctID = Convert.ToInt32(lblID.Text);

            Model.Menu mn = db.Menus.Find(slctID);
            db.Menus.Remove(mn);
            db.SaveChanges();
            updateMenu();
            ClearAddMenu();
        }
Esempio n. 2
0
        private void btnSaveMenu_Click(object sender, EventArgs e)
        {
            int slctID = Convert.ToInt32(lblID.Text);

            Model.Menu mn = db.Menus.Find(slctID);

            string  name   = txtMenuName.Text;
            decimal price  = nmMenuPrice.Value;
            int     time   = (int)nmMenuTime.Value;
            int     ctgrID = ((CategoryCombo)cmbMenuCategory.SelectedItem).Value;

            mn.Name           = name;
            mn.Price_AZN      = price;
            mn.Prepation_time = time;
            mn.CategoryID     = ctgrID;

            db.SaveChanges();
            updateMenu();
            ClearAddMenu();
        }