public IHttpActionResult PutDocumentoTDB(long id, DocumentoTDB documentoTDB) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != documentoTDB.idDocumento) { return(BadRequest()); } db.Entry(documentoTDB).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DocumentoTDBExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetDocumentoTDB(long id) { DocumentoTDB documentoTDB = db.DocumentoTDB.Find(id); if (documentoTDB == null) { return(NotFound()); } return(Ok(documentoTDB)); }
public IHttpActionResult PostDocumentoTDB(DocumentoTDB documentoTDB) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DocumentoTDB.Add(documentoTDB); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = documentoTDB.idDocumento }, documentoTDB)); }
public IHttpActionResult DeleteDocumentoTDB(long id) { DocumentoTDB documentoTDB = db.DocumentoTDB.Find(id); if (documentoTDB == null) { return(NotFound()); } db.DocumentoTDB.Remove(documentoTDB); db.SaveChanges(); return(Ok(documentoTDB)); }