public IHttpActionResult PutVendor(int id, Vendor vendor) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != vendor.VendorId) { return(BadRequest()); } db.Entry(vendor).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!VendorExists(id)) { return(NotFound()); } else { throw; } } return(Json(vendor)); }
public IHttpActionResult PutProduct(int id, Product product) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != product.ProductId) { return(BadRequest()); } db.Entry(product).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(id)) { return(NotFound()); } else { throw; } } return(Json(product)); }
public void Update(Item item) { _db.Entry(item).State = EntityState.Modified; //_db.SaveChanges(); }