public IHttpActionResult PutSourceDocIndex(int id, SourceDocIndex sourceDocIndex) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != sourceDocIndex.ID) { return(BadRequest()); } db.Entry(sourceDocIndex).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SourceDocIndexExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetSourceDocIndex(int id) { SourceDocIndex sourceDocIndex = db.SourceDocIndex.Find(id); if (sourceDocIndex == null) { return(NotFound()); } return(Ok(sourceDocIndex)); }
public IHttpActionResult PostSourceDocIndex(SourceDocIndex sourceDocIndex) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.SourceDocIndex.Add(sourceDocIndex); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = sourceDocIndex.ID }, sourceDocIndex)); }
public IHttpActionResult DeleteSourceDocIndex(int id) { SourceDocIndex sourceDocIndex = db.SourceDocIndex.Find(id); if (sourceDocIndex == null) { return(NotFound()); } db.SourceDocIndex.Remove(sourceDocIndex); db.SaveChanges(); return(Ok(sourceDocIndex)); }