public IHttpActionResult PutTipoSensor(int id, TipoSensor tipoSensor) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != tipoSensor.cd_tpsensor) { return BadRequest(); } db.Entry(tipoSensor).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TipoSensorExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostTipoSensor(TipoSensor tipoSensor) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.TipoSensor.Add(tipoSensor); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = tipoSensor.cd_tpsensor }, tipoSensor); }