///<summary> ////Update existing Product details ///<param>Product</param> ///</summary> public async Task <bool> UpdateProduct(Product item) { try { db.Entry(item).State = EntityState.Modified; await db.SaveChangesAsync(); } catch (Exception dbUpdateException) { if (!ProductExists(item.Id)) { throw new Exception("Product not found."); } else { throw dbUpdateException; } } return(true); }
public HttpResponseMessage Put(int id, [FromBody] TblProduct value) { ProductsDB.Entry(value).State = EntityState.Modified; return(ToJson(ProductsDB.SaveChanges())); }