public static void delete(tbl_DetuctInventory di)
        {
            RMSDBEntities db = DBContext.getInstance();

            db.tbl_DetuctInventory.Remove(di);
            db.SaveChanges();
        }
        public static void insert(tbl_DetuctInventory di)
        {
            RMSDBEntities db = DBContext.getInstance();

            db.tbl_DetuctInventory.Add(di);
            db.SaveChanges();
        }
 private void btn_Delete(object sender, RoutedEventArgs e)
 {
     if (dg_AllLinkedItems.SelectedItem != null)
     {
         tbl_DetuctInventory di = (tbl_DetuctInventory)dg_AllLinkedItems.SelectedItem;
         DetuctInventory.delete(di);
         dg_AllLinkedItems.ItemsSource = null;
         dg_AllLinkedItems.ItemsSource = DetuctInventory.getAll();
     }
 }
 private void btn_Save(object sender, RoutedEventArgs e)
 {
     foreach (DetuctInventoryModel item in list)
     {
         tbl_DetuctInventory di = new tbl_DetuctInventory();
         di.FoodItem_Id         = foodId;
         di.KitchenInventory_id = item.id;
         di.DeductedQuantity    = item.quantity;
         DetuctInventory.insert(di);
     }
     AutoClosingMessageBox.Show("Inventory Status Saved", "Success", 2000);
     Close();
     new Form_LinkKitchenInventory().Show();
 }