示例#1
0
 public ActionResult <StickerShopItems> Post([FromBody] StickerShopItems stickers)
 {
     //Create new inventory items
     db.StickerItems.Add(stickers);
     db.SaveChanges();
     return(stickers);
 }
示例#2
0
        public ActionResult <StickerShopItems> UpdateItem([FromRoute] int id, [FromBody] StickerShopItems item)
        {
            //Update each Sticker item in my Inventory
            var stickerData = db.StickerItems.FirstOrDefault(f => f.Id == id);

            stickerData.SKU         = item.SKU;
            stickerData.Name        = item.Name;
            stickerData.Description = item.Description;
            stickerData.Price       = item.Price;
            stickerData.DateOrdered = item.DateOrdered;
            db.SaveChanges();
            return(stickerData);
        }