public async Task<IHttpActionResult> PutSpeakers(Guid id, Speakers speakers) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != speakers.id) { return BadRequest(); } db.Entry(speakers).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SpeakersExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostSpeakers(Speakers speakers) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Speakers.Add(speakers); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = speakers.id }, speakers); }