public IHttpActionResult PutCaution(int id, Caution caution) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != caution.Id) { return BadRequest(); } db.Entry(caution).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CautionExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostCaution(Caution caution) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Cautions.Add(caution); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = caution.Id }, caution); }