public async Task <IHttpActionResult> PostLiveShowView(LiveShowView liveShowView) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.LiveShowViews.Add(liveShowView); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (LiveShowViewExists(liveShowView.id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = liveShowView.id }, liveShowView)); }
public async Task <IHttpActionResult> PutLiveShowView(Guid id, LiveShowView liveShowView) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != liveShowView.id) { return(BadRequest()); } db.Entry(liveShowView).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LiveShowViewExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetLiveShowView(Guid id) { LiveShowView liveShowView = await db.LiveShowViews.FindAsync(id); if (liveShowView == null) { return(NotFound()); } return(Ok(liveShowView)); }
public async Task <IHttpActionResult> DeleteLiveShowView(Guid id) { LiveShowView liveShowView = await db.LiveShowViews.FindAsync(id); if (liveShowView == null) { return(NotFound()); } db.LiveShowViews.Remove(liveShowView); await db.SaveChangesAsync(); return(Ok(liveShowView)); }