public async Task <IHttpActionResult> PutEvent_Going(int id, Event_Going event_Going) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != event_Going.Id) { return(BadRequest()); } db.Entry(event_Going).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Event_GoingExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetEvent_Going(int id) { Event_Going event_Going = await db.Event_Going.FindAsync(id); if (event_Going == null) { return(NotFound()); } return(Ok(event_Going)); }
public async Task <IHttpActionResult> PostEvent_Going(Event_Going event_Going) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Event_Going.Add(event_Going); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = event_Going.Id }, event_Going)); }
public async Task <IHttpActionResult> DeleteEvent_Going(int id) { Event_Going event_Going = await db.Event_Going.FindAsync(id); if (event_Going == null) { return(NotFound()); } db.Event_Going.Remove(event_Going); await db.SaveChangesAsync(); return(Ok(event_Going)); }