public IHttpActionResult PutTDMOPR(int id, TDMOPR tDMOPR) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tDMOPR.Id_MOPR) { return(BadRequest()); } db.Entry(tDMOPR).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TDMOPRExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetTDMOPR(int id) { TDMOPR tDMOPR = db.TDMOPRs.Find(id); if (tDMOPR == null) { return(NotFound()); } return(Ok(tDMOPR)); }
public IHttpActionResult PostTDMOPR(TDMOPR tDMOPR) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TDMOPRs.Add(tDMOPR); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tDMOPR.Id_MOPR }, tDMOPR)); }
public IHttpActionResult DeleteTDMOPR(int id) { TDMOPR tDMOPR = db.TDMOPRs.Find(id); if (tDMOPR == null) { return(NotFound()); } db.TDMOPRs.Remove(tDMOPR); db.SaveChanges(); return(Ok(tDMOPR)); }