public IHttpActionResult PutdeliveryDetail(int id, deliveryDetail deliveryDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != deliveryDetail.deliveryid) { return(BadRequest()); } db.Entry(deliveryDetail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!deliveryDetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetdeliveryDetail(int id) { deliveryDetail deliveryDetail = db.deliveryDetails.Find(id); if (deliveryDetail == null) { return(NotFound()); } return(Ok(deliveryDetail)); }
public IHttpActionResult PostdeliveryDetail(deliveryDetail deliveryDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.deliveryDetails.Add(deliveryDetail); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = deliveryDetail.deliveryid }, deliveryDetail)); }
public IHttpActionResult DeletedeliveryDetail(int id) { deliveryDetail deliveryDetail = db.deliveryDetails.Find(id); if (deliveryDetail == null) { return(NotFound()); } db.deliveryDetails.Remove(deliveryDetail); db.SaveChanges(); return(Ok(deliveryDetail)); }