public async Task <IHttpActionResult> Putusers_comments(int id, users_comments users_comments) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != users_comments.id) { return(BadRequest()); } db.Entry(users_comments).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!users_commentsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Getusers_comments(int id) { users_comments users_comments = await db.users_comments.FindAsync(id); if (users_comments == null) { return(NotFound()); } return(Ok(users_comments)); }
public async Task <IHttpActionResult> Postusers_comments(users_comments users_comments) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.users_comments.Add(users_comments); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = users_comments.id }, users_comments)); }
public async Task <IHttpActionResult> Deleteusers_comments(int id) { users_comments users_comments = await db.users_comments.FindAsync(id); if (users_comments == null) { return(NotFound()); } db.users_comments.Remove(users_comments); await db.SaveChangesAsync(); return(Ok(users_comments)); }