示例#1
0
        public static async void RemoveItem(int itemID)
        {
            var             db      = new SoftwareStudioContext();
            Laboratory_item labItem = await db.laboratory_items.FirstOrDefaultAsync(labItem => labItem.item_id == itemID);

            if (labItem != null)
            {
                db.Remove(labItem);
                db.SaveChanges();
            }
        }
示例#2
0
        public static void AddItem(int labID, int itemID)
        {
            var             db      = new SoftwareStudioContext();
            Laboratory_item labItem = new Laboratory_item(labID, itemID);

            if (labItem != null)
            {
                db.laboratory_items.Add(labItem);
                db.SaveChanges();
            }
        }