public IHttpActionResult PutExamenRealise(int id, ExamenRealise examenRealise) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != examenRealise.codeExamReal) { return BadRequest(); } db.Entry(examenRealise).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ExamenRealiseExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostExamenRealise(ExamenRealise examenRealise) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.ExamenRealise.Add(examenRealise); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = examenRealise.codeExamReal }, examenRealise); }