public async Task<IHttpActionResult> PutCircle(int id, Circle circle) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != circle.Id) { return BadRequest(); } db.Entry(circle).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CircleExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostCircle(Circle circle) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Circles.Add(circle); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = circle.Id }, circle); }