public IHttpActionResult PostReceiptDelay(ReceiptDelay receiptdelay) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ReceiptDelays.Add(receiptdelay); try { db.SaveChanges(); } catch (DbUpdateException) { if (ReceiptDelayExists(receiptdelay.receiptDelayId)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = receiptdelay.receiptDelayId }, receiptdelay)); }
// PUT api/ReceiptDelay/5 public IHttpActionResult PutReceiptDelay(int id, ReceiptDelay receiptdelay) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != receiptdelay.receiptDelayId) { return(BadRequest()); } db.Entry(receiptdelay).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ReceiptDelayExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetReceiptDelay(int id) { ReceiptDelay receiptdelay = db.ReceiptDelays.Find(id); if (receiptdelay == null) { return(NotFound()); } return(Ok(receiptdelay)); }
public IHttpActionResult DeleteReceiptDelay(int id) { ReceiptDelay receiptdelay = db.ReceiptDelays.Find(id); if (receiptdelay == null) { return(NotFound()); } db.ReceiptDelays.Remove(receiptdelay); db.SaveChanges(); return(Ok(receiptdelay)); }