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)); }
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)); }