public IHttpActionResult Putdocumentcontent(int id, documentcontent documentcontent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != documentcontent.ID) { return(BadRequest()); } db.Entry(documentcontent).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!documentcontentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getdocumentcontent(int id) { documentcontent documentcontent = db.documentcontents.Find(id); if (documentcontent == null) { return(NotFound()); } return(Ok(documentcontent)); }
public IHttpActionResult Postdocumentcontent(documentcontent documentcontent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.documentcontents.Add(documentcontent); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = documentcontent.ID }, documentcontent)); }
public IHttpActionResult Deletedocumentcontent(int id) { documentcontent documentcontent = db.documentcontents.Find(id); if (documentcontent == null) { return(NotFound()); } db.documentcontents.Remove(documentcontent); db.SaveChanges(); return(Ok(documentcontent)); }