コード例 #1
0
 public ActionResult Edit([Bind(Include = "MovieID,Title,Director,Genre,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 = "CustomerID,FName,LName,Phone")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "RentalID,CustomerID,MovieID,DateRented")] Rental rental)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rental).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "FName", rental.CustomerID);
     ViewBag.MovieID    = new SelectList(db.Movies, "MovieID", "Title", rental.MovieID);
     return(View(rental));
 }