public IHttpActionResult PutReview(int id, Review review)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != review.Id)
            {
                return(BadRequest());
            }

            db.Entry(review).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ReviewExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult Put(int id, Movie movie)
        {
            movie.Id = id;
            db.Entry(movie).State = EntityState.Modified;
            db.SaveChanges();

            return(Ok());
        }
Beispiel #3
0
        public IHttpActionResult Put(int id, User user)
        {
            user.Id = id;
            db.Entry(user).State = EntityState.Modified;
            db.SaveChanges();

            return(Ok());
        }