public IHttpActionResult PutProductdetail(int id, Productdetail productdetail) { if (id != productdetail.id) { return(BadRequest()); } db.Entry(productdetail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProductdetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetProductdetail(int id) { Productdetail productdetail = db.Productdetails.Find(id); if (productdetail == null) { return(NotFound()); } return(Ok(productdetail)); }
public IHttpActionResult DeleteProductdetail(int id) { Productdetail productdetail = db.Productdetails.Find(id); if (productdetail == null) { return(NotFound()); } db.Productdetails.Remove(productdetail); db.SaveChanges(); return(Ok(productdetail)); }
public IHttpActionResult PostProductdetail(Productdetail productdetail) { db.Productdetails.Add(productdetail); try { db.SaveChanges(); } catch (DbUpdateException) { if (ProductdetailExists(productdetail.id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = productdetail.id }, productdetail)); }