public async Task <IHttpActionResult> PuttUserEvent(int id, tUserEvent tUserEvent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tUserEvent.ID) { return(BadRequest()); } db.Entry(tUserEvent).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!tUserEventExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GettUserEvent(int id) { tUserEvent tUserEvent = await db.tUserEvents.FindAsync(id); if (tUserEvent == null) { return(NotFound()); } return(Ok(tUserEvent)); }
public async Task <IHttpActionResult> PosttUserEvent(tUserEvent tUserEvent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tUserEvents.Add(tUserEvent); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = tUserEvent.ID }, tUserEvent)); }
public async Task <IHttpActionResult> DeletetUserEvent(int id) { tUserEvent tUserEvent = await db.tUserEvents.FindAsync(id); if (tUserEvent == null) { return(NotFound()); } db.tUserEvents.Remove(tUserEvent); await db.SaveChangesAsync(); return(Ok(tUserEvent)); }