public IHttpActionResult PutPurchaseTicketLineItem(int id, PurchaseTicketLineItem purchaseTicketLineItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != purchaseTicketLineItem.Id) { return(BadRequest()); } db.Entry(purchaseTicketLineItem).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PurchaseTicketLineItemExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetPurchaseTicketLineItem(int id) { PurchaseTicketLineItem purchaseTicketLineItem = db.PurchaseTicketLineItems.Find(id); if (purchaseTicketLineItem == null) { return(NotFound()); } return(Ok(purchaseTicketLineItem)); }
public IHttpActionResult PostPurchaseTicketLineItem(PurchaseTicketLineItem purchaseTicketLineItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PurchaseTicketLineItems.Add(purchaseTicketLineItem); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = purchaseTicketLineItem.Id }, purchaseTicketLineItem)); }
public IHttpActionResult DeletePurchaseTicketLineItem(int id) { PurchaseTicketLineItem purchaseTicketLineItem = db.PurchaseTicketLineItems.Find(id); if (purchaseTicketLineItem == null) { return(NotFound()); } db.PurchaseTicketLineItems.Remove(purchaseTicketLineItem); db.SaveChanges(); return(Ok(purchaseTicketLineItem)); }