public IHttpActionResult PostJusRecord(JusRecord jusRecord) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.JusRecords.Add(jusRecord); try { db.SaveChanges(); } catch (DbUpdateException) { if (JusRecordExists(jusRecord.RecordID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = jusRecord.RecordID }, jusRecord)); }
public IHttpActionResult PutJusRecord(string id, JusRecord jusRecord) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != jusRecord.RecordID) { return(BadRequest()); } db.Entry(jusRecord).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!JusRecordExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetJusRecord(string id) { JusRecord jusRecord = db.JusRecords.Find(id); if (jusRecord == null) { return(NotFound()); } return(Ok(jusRecord)); }
public IHttpActionResult DeleteJusRecord(string id) { JusRecord jusRecord = db.JusRecords.Find(id); if (jusRecord == null) { return(NotFound()); } db.JusRecords.Remove(jusRecord); db.SaveChanges(); return(Ok(jusRecord)); }