public IHttpActionResult PutProductOwnership(DateTime id, ProductOwnership productOwnership) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != productOwnership.BuyDate) { return BadRequest(); } db.Entry(productOwnership).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProductOwnershipExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult GetProductOwnership(DateTime id) { ProductOwnership productOwnership = db.ProductOwnerships.Find(id); if (productOwnership == null) { return NotFound(); } return Ok(productOwnership); }
public IHttpActionResult DeleteProductOwnership(DateTime id) { ProductOwnership productOwnership = db.ProductOwnerships.Find(id); if (productOwnership == null) { return NotFound(); } db.ProductOwnerships.Remove(productOwnership); db.SaveChanges(); return Ok(productOwnership); }