public IHttpActionResult PostENC_EMPLEADOS(ENC_EMPLEADOS eNC_EMPLEADOS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ENC_EMPLEADOS.Add(eNC_EMPLEADOS); try { db.SaveChanges(); } catch (DbUpdateException) { if (ENC_EMPLEADOSExists(eNC_EMPLEADOS.IDEMPLEADO)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = eNC_EMPLEADOS.IDEMPLEADO }, eNC_EMPLEADOS)); }
public IHttpActionResult PutENC_EMPLEADOS(decimal id, ENC_EMPLEADOS eNC_EMPLEADOS) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eNC_EMPLEADOS.IDEMPLEADO) { return(BadRequest()); } db.Entry(eNC_EMPLEADOS).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ENC_EMPLEADOSExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetENC_EMPLEADOS(decimal id) { ENC_EMPLEADOS eNC_EMPLEADOS = db.ENC_EMPLEADOS.Find(id); if (eNC_EMPLEADOS == null) { return(NotFound()); } return(Ok(eNC_EMPLEADOS)); }
public IHttpActionResult DeleteENC_EMPLEADOS(decimal id) { ENC_EMPLEADOS eNC_EMPLEADOS = db.ENC_EMPLEADOS.Find(id); if (eNC_EMPLEADOS == null) { return(NotFound()); } db.ENC_EMPLEADOS.Remove(eNC_EMPLEADOS); db.SaveChanges(); return(Ok(eNC_EMPLEADOS)); }