Esempio n. 1
0
        public HttpResponseMessage Delete(int id)
        {
            var product = WoodDB.Product.FirstOrDefault(x => x.Id == id);

            if (product == null)
            {
                throw new ArgumentNullException();
            }

            WoodDB.Product.Remove(product);
            return(ToJson(WoodDB.SaveChanges()));
        }
Esempio n. 2
0
 public HttpResponseMessage Put(int id, [FromBody] Product value)
 {
     WoodDB.Entry(value).State = EntityState.Modified;
     return(ToJson(WoodDB.SaveChanges()));
 }