コード例 #1
0
 public ActionResult Edit([Bind(Include = "MovieId,Title,Description,Rating,ReleaseDate")] Movie movie)
 {
     if (ModelState.IsValid)
     {
         db.Entry(movie).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(movie));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "ActorId,Name,Surname,DateofBirth")] Actor actor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(actor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(actor));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "MovieId,ActorId")] MovieActor movieActor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(movieActor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ActorId = new SelectList(db.Actors, "ActorId", "Name", movieActor.ActorId);
     ViewBag.MovieId = new SelectList(db.Movies, "MovieId", "Title", movieActor.MovieId);
     return(View(movieActor));
 }