Exemple #1
0
 public ActionResult Edit([Bind(Include = "Name,Id,Sex,DOB,Bio")] Actor actor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(actor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(actor));
 }
 public ActionResult Edit([Bind(Include = "Admin_ID,Admin_Name,Admin_Password,DateOfBirth,Admin_Contact")] AdminTable adminTable)
 {
     if (ModelState.IsValid)
     {
         db.Entry(adminTable).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(adminTable));
 }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "Name,Plot,Poster,Release_Year,Producer_Id,Id")] Movy movy)
 {
     if (ModelState.IsValid)
     {
         db.Entry(movy).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Producer_Id = new SelectList(db.Producers, "Id", "Name", movy.Producer_Id);
     return(View(movy));
 }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "Id,MovieID")] Favourite favourite)
 {
     if (ModelState.IsValid)
     {
         db.Entry(favourite).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Id = new SelectList(db.Accounts, "Id", "EmailID", favourite.Id);
     return(View(favourite));
 }
 public ActionResult Edit([Bind(Include = "Id,Actor_Id,Movie_Id")] Movie_Actors movie_Actors)
 {
     if (ModelState.IsValid)
     {
         db.Entry(movie_Actors).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Actor_Id = new SelectList(db.Actors, "Id", "Name", movie_Actors.Actor_Id);
     ViewBag.Movie_Id = new SelectList(db.Movies, "Id", "Name", movie_Actors.Movie_Id);
     return(View(movie_Actors));
 }
Exemple #6
0
        public bool UpdateMovie(DataAccess.Movie movie)     //更新電影
        {
            MovieEntities dbMovie = new MovieEntities();

            DataAccess.Movie queryMovie = dbMovie.Movie.FirstOrDefault(x => x.ID == movie.ID);
            if (queryMovie != null)
            {
                dbMovie.Entry(queryMovie).CurrentValues.SetValues(movie);
                dbMovie.SaveChanges();
                return(true);
            }
            return(false);
        }
Exemple #7
0
 public ActionResult Edit([Bind(Include = "Id,EmailID,Username,Password,ConfirmPassword")] Account account)
 {
     if (Session["Username"] != null)
     {
         if (ModelState.IsValid)
         {
             db.Entry(account).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("MyProfile"));
         }
         return(View(account));
     }
     else
     {
         return(RedirectToAction("Login", "Accounts"));
     }
 }