public IHttpActionResult PutPerformance(int id, Performance performance) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != performance.Id) { return BadRequest(); } db.Entry(performance).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PerformanceExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostPerformance(Performance performance) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Performances.Add(performance); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = performance.Id }, performance); }