示例#1
0
        public async Task <IActionResult> Edit(long id, [Bind("Id,Prefix,FirstName,MiddleName,LastName,Suffix,PreferredFullName,Gender,DateOfBirth,DateOfDeath,Biography")] FilmMember filmMember)
        {
            if (id != filmMember.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(filmMember);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FilmMemberExists(filmMember.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(filmMember));
        }
示例#2
0
        public async Task <IActionResult> Edit(long id, [Bind("MovieId,GenreId")] MovieGenre movieGenre)
        {
            if (id != movieGenre.MovieId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(movieGenre);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MovieGenreExists(movieGenre.MovieId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GenreId"] = new SelectList(_context.Genre, "Id", "GenreName", movieGenre.GenreId);
            ViewData["MovieId"] = new SelectList(_context.Movie, "Id", "Title", movieGenre.MovieId);
            return(View(movieGenre));
        }
        public async Task <IActionResult> Edit(long id, [Bind("MovieId,ActorFilmMemberId,CharacterName,Sequence")] MovieCastMember movieCastMember)
        {
            if (id != movieCastMember.MovieId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(movieCastMember);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MovieCastMemberExists(movieCastMember.MovieId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ActorFilmMemberId"] = new SelectList(_context.FilmMember, "Id", "FirstName", movieCastMember.ActorFilmMemberId);
            ViewData["MovieId"]           = new SelectList(_context.Movie, "Id", "Title", movieCastMember.MovieId);
            return(View(movieCastMember));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,MovieId,ImageName,ImageTypeId,Description,FileContents,DateUploaded")] MovieImage movieImage)
        {
            if (id != movieImage.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(movieImage);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MovieImageExists(movieImage.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ImageTypeId"] = new SelectList(_context.ImageType, "Id", "ImageExtension", movieImage.ImageTypeId);
            ViewData["MovieId"]     = new SelectList(_context.Movie, "Id", "Title", movieImage.MovieId);
            return(View(movieImage));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,MovieId,UserId,Rating,Review,DatePosted")] MovieUserReview movieUserReview)
        {
            if (id != movieUserReview.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(movieUserReview);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MovieUserReviewExists(movieUserReview.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MovieId"] = new SelectList(_context.Movie, "Id", "Title", movieUserReview.MovieId);
            ViewData["UserId"]  = new SelectList(_context.User, "Id", "EmailAddress", movieUserReview.UserId);
            return(View(movieUserReview));
        }
示例#6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,AwardShowId,Year,DateHosted")] AwardShowInstance awardShowInstance)
        {
            if (id != awardShowInstance.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(awardShowInstance);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AwardShowInstanceExists(awardShowInstance.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AwardShowId"] = new SelectList(_context.AwardShow, "Id", "ShowName", awardShowInstance.AwardShowId);
            return(View(awardShowInstance));
        }
        public async Task <IActionResult> Edit(long id, [Bind("Id,Title,Description,ReleaseDate,RestrictionRatingId,DirectorFilmMemberId,DurationInMinutes,AverageUserRating")] Movie movie)
        {
            if (id != movie.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(movie);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MovieExists(movie.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RestrictionRatingId"] = new SelectList(_context.RestrictionRating, "Id", "Code", movie.RestrictionRatingId);
            return(View(movie));
        }
示例#8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,GenreName,Description")] Genre genre)
        {
            if (id != genre.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(genre);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GenreExists(genre.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(genre));
        }
        public async Task <IActionResult> Edit(short id, [Bind("Id,Code,ShortDescription,LongDescription,IsActive")] RestrictionRating restrictionRating)
        {
            if (id != restrictionRating.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(restrictionRating);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RestrictionRatingExists(restrictionRating.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(restrictionRating));
        }
 public async Task <IActionResult> Edit([Bind("AwardShowInstanceId,AwardId,FilmMemberId,MovieId")] AwardWinner awardWinner)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(awardWinner);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!AwardWinnerExists(awardWinner.AwardShowInstanceId))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     CreateAwardIdSelectList();
     ViewData["AwardShowInstanceId"] = new SelectList(_context.AwardShowInstance, "Id", "Id", awardWinner.AwardShowInstanceId);
     ViewData["FilmMemberId"]        = new SelectList(_context.FilmMember, "Id", "FirstName", awardWinner.FilmMemberId);
     ViewData["MovieId"]             = new SelectList(_context.Movie, "Id", "Description", awardWinner.MovieId);
     return(View(awardWinner));
 }
示例#11
0
        public async Task <IActionResult> Edit(string id, [Bind("LanguageIsoCode,LanguageName")] Language language)
        {
            if (id != language.LanguageIsoCode)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(language);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LanguageExists(language.LanguageIsoCode))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(language));
        }
示例#12
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,UserName,EmailAddress,HashedPassword")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (await _context.User.AnyAsync(u => u.Id == id && u.UserName != user.UserName))
                    {
                        throw new InvalidOperationException("User name cannot be changed");
                    }

                    user.HashedPassword = HashUsersPassword(user.HashedPassword);

                    // Set all users added via this form to user role.  Admins must be added via database.
                    user.UserRoleId = (int)DbEnum.UserRole.User;

                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }