public async Task <IHttpActionResult> PutEventActivitySpeaker(int id, EventActivitySpeaker eventActivitySpeaker) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eventActivitySpeaker.SpeakerID) { return(BadRequest()); } db.Entry(eventActivitySpeaker).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventActivitySpeakerExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetEventActivitySpeaker(int id) { EventActivitySpeaker eventActivitySpeaker = await db.EventActivitySpeakers.FindAsync(id); if (eventActivitySpeaker == null) { return(NotFound()); } return(Ok(eventActivitySpeaker)); }
public async Task <IHttpActionResult> PostEventActivitySpeaker(EventActivitySpeaker eventActivitySpeaker) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.EventActivitySpeakers.Add(eventActivitySpeaker); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = eventActivitySpeaker.SpeakerID }, eventActivitySpeaker)); }
public async Task <IHttpActionResult> DeleteEventActivitySpeaker(int id) { EventActivitySpeaker eventActivitySpeaker = await db.EventActivitySpeakers.FindAsync(id); if (eventActivitySpeaker == null) { return(NotFound()); } db.EventActivitySpeakers.Remove(eventActivitySpeaker); await db.SaveChangesAsync(); return(Ok(eventActivitySpeaker)); }