public IHttpActionResult PutMovie(int id, Movie movie) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != movie.Id) { return(BadRequest()); } db.Entry(movie).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MovieExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "Id,Title,Category")] Movie movie) { if (ModelState.IsValid) { db.Entry(movie).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(movie)); }