public async Task <IHttpActionResult> Putservices_comments(int id, services_comments services_comments) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != services_comments.id) { return(BadRequest()); } db.Entry(services_comments).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!services_commentsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Getservices_comments(int id) { services_comments services_comments = await db.services_comments.FindAsync(id); if (services_comments == null) { return(NotFound()); } return(Ok(services_comments)); }
public async Task <IHttpActionResult> Postservices_comments(services_comments services_comments) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.services_comments.Add(services_comments); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = services_comments.id }, services_comments)); }
public async Task <IHttpActionResult> Deleteservices_comments(int id) { services_comments services_comments = await db.services_comments.FindAsync(id); if (services_comments == null) { return(NotFound()); } db.services_comments.Remove(services_comments); await db.SaveChangesAsync(); return(Ok(services_comments)); }