public IHttpActionResult PutTrabajador(int id, Trabajador trabajador) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != trabajador.TrabajadorId) { return(BadRequest()); } db.Entry(trabajador).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TrabajadorExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutContrato(int id, Contrato contrato) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != contrato.ContratoId) { return(BadRequest()); } db.Entry(contrato).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ContratoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutProvincia(int id, Provincia provincia) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != provincia.ProvinciaId) { return(BadRequest()); } db.Entry(provincia).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProvinciaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutEvaluacion(int id, Evaluacion evaluacion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != evaluacion.EvaluacionId) { return(BadRequest()); } db.Entry(evaluacion).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EvaluacionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void StateModified(object Entity) { _Context.Entry(Entity).State = System.Data.Entity.EntityState.Modified; }