コード例 #1
0
 public ActionResult Edit([Bind(Include = "CustomerID,CustomerName,CustomerPhone")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "GenreID,GenreName")] Genre genre)
 {
     if (ModelState.IsValid)
     {
         db.Entry(genre).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(genre));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "MovieID,MovieName,MovieDescription,MovieGenre")] Movie movie)
 {
     if (ModelState.IsValid)
     {
         db.Entry(movie).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MovieGenre = new SelectList(db.Genres, "GenreID", "GenreName", movie.MovieGenre);
     return(View(movie));
 }
コード例 #4
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name")] Movy movy)
        {
            if (ModelState.IsValid)
            {
                db.Entry(movy).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(movy));
        }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "RentalID,MovieID,CustomerID,RentalDate,DueDate,ReturnDate")] RentalRecord rentalRecord)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rentalRecord).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MovieID = new SelectList(db.Movies, "MovieID", "MovieName", rentalRecord.MovieID);
     return(View(rentalRecord));
 }
コード例 #6
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,AspNetUserID,FirstName,LastName,DateOfBirth")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Entry(customer).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.AspNetUserID = new SelectList(db.AspNetUsers, "Id", "Email", customer.AspNetUserID);
            return(View(customer));
        }