示例#1
0
        public ActionResult Edit(int movieId, Review review)
        {
            var db = new MovieData();

            if (ModelState.IsValid)
            {
                db.Entry(review).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Details", "Movies", new { id = movieId }));
            }
            return(View(review));
        }
示例#2
0
 public HttpResponseMessage Put(int id, Movie movie)
 {
     if (!ModelState.IsValid)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
     }
     try
     {
         _db.Entry(movie).State = EntityState.Modified;
         _db.SaveChanges();
     }
     catch (DbUpdateConcurrencyException ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.Conflict, ex));
     }
     return(Request.CreateResponse(HttpStatusCode.OK));
 }