public IHttpActionResult PutTMCENTROS(int id, TMCENTROS tMCENTROS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tMCENTROS.Id_Centro) { return(BadRequest()); } db.Entry(tMCENTROS).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TMCENTROSExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetTMCENTROS(int id) { TMCENTROS tMCENTROS = db.TMCENTROes.Find(id); if (tMCENTROS == null) { return(NotFound()); } return(Ok(tMCENTROS)); }
public IHttpActionResult PostTMCENTROS(TMCENTROS tMCENTROS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TMCENTROes.Add(tMCENTROS); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tMCENTROS.Id_Centro }, tMCENTROS)); }
public IHttpActionResult DeleteTMCENTROS(int id) { TMCENTROS tMCENTROS = db.TMCENTROes.Find(id); if (tMCENTROS == null) { return(NotFound()); } db.TMCENTROes.Remove(tMCENTROS); db.SaveChanges(); return(Ok(tMCENTROS)); }