public IHttpActionResult PutKPI(int id, KPI kPI) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != kPI.KPIID) { return BadRequest(); } db.Entry(kPI).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!KPIExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.OK); }
public IHttpActionResult PostKPI(KPI kPI) { if (!ModelState.IsValid) { return BadRequest(ModelState); } kPI.Estado = true; db.KPIs.Add(kPI); db.SaveChanges(); return StatusCode(HttpStatusCode.OK); }