public IHttpActionResult PutPost_Update(int id, Post_Update post_Update) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != post_Update.Post_Update_ID) { return(BadRequest()); } db.Entry(post_Update).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Post_UpdateExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetPost_Update(int id) { Post_Update post_Update = db.Post_Update.Find(id); if (post_Update == null) { return(NotFound()); } return(Ok(post_Update)); }
public IHttpActionResult PostPost_Update(Post_Update post_Update) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Post_Update.Add(post_Update); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = post_Update.Post_Update_ID }, post_Update)); }
public IHttpActionResult DeletePost_Update(int id) { Post_Update post_Update = db.Post_Update.Find(id); if (post_Update == null) { return(NotFound()); } db.Post_Update.Remove(post_Update); db.SaveChanges(); return(Ok(post_Update)); }