public IHttpActionResult PutsoldItemDetail(int id, soldItemDetail soldItemDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != soldItemDetail.id) { return(BadRequest()); } db.Entry(soldItemDetail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!soldItemDetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetsoldItemDetail(int id) { soldItemDetail soldItemDetail = db.soldItemDetails.Find(id); if (soldItemDetail == null) { return(NotFound()); } return(Ok(soldItemDetail)); }
public IHttpActionResult PostsoldItemDetail(soldItemDetail soldItemDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.soldItemDetails.Add(soldItemDetail); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = soldItemDetail.id }, soldItemDetail)); }
public IHttpActionResult DeletesoldItemDetail(int id) { soldItemDetail soldItemDetail = db.soldItemDetails.Find(id); if (soldItemDetail == null) { return(NotFound()); } db.soldItemDetails.Remove(soldItemDetail); db.SaveChanges(); return(Ok(soldItemDetail)); }