예제 #1
0
        public void Delete(int id)
        {
            PostsIndhold postsIndhold = db.postsindhold.Find(id);

            if (postsIndhold == null)
            {
                Response.StatusCode = (int)HttpStatusCode.NotFound;
                return;
            }
            db.postsindhold.Remove(postsIndhold);
            db.SaveChanges();

            Response.StatusCode = (int)HttpStatusCode.OK;
        }
예제 #2
0
        public ActionResult Put(int id, [FromBody] string post_to_update)
        {
            dynamic      Objectpost   = JsonConvert.DeserializeObject(post_to_update);
            PostsIndhold postsIndhold = db.postsindhold.Find(id);

            if (postsIndhold == null)
            {
                Response.StatusCode = (int)HttpStatusCode.NotFound;
                return(Json(null));
            }

            Response.StatusCode = (int)HttpStatusCode.OK;
            return(Json(postsIndhold));
        }