public IHttpActionResult PutCorrelation(int id, Correlation correlation) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != correlation.CorrelationID) { return BadRequest(); } db.Entry(correlation).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CorrelationExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostCorrelation(Correlation correlation) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Correlations.Add(correlation); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = correlation.CorrelationID }, correlation); }