Exemplo n.º 1
0
        public ActionResult <LISTS_38_ITEM> Post(LISTS_38_ITEM item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            db.Lists_38_Items.Add(item);
            db.SaveChangesAsync();
            return(item);
        }
Exemplo n.º 2
0
        public ActionResult <LISTS_38_ITEM> Delete(string itemId)
        {
            if (string.IsNullOrEmpty(itemId))
            {
                return(BadRequest());
            }

            LISTS_38_ITEM item = db.Lists_38_Items.FirstOrDefault(x => x.ITEM_KEY == itemId);

            if (item == null)
            {
                return(NotFound());
            }

            db.Lists_38_Items.Remove(item);
            db.SaveChangesAsync();
            return(item);
        }
Exemplo n.º 3
0
        public ActionResult <LISTS_38_ITEM> Put(LISTS_38_ITEM item)
        {
            if (item == null)
            {
                return(BadRequest());
            }

            bool hasItem = db.Lists_38_Items.Any(x => x.ITEM_KEY == item.ITEM_KEY);

            if (!hasItem)
            {
                return(NotFound());
            }

            db.Update(item);
            db.SaveChangesAsync();
            return(item);
        }