Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Title,ReleaseDate,Genre,Price,Rating,PosterURL")] 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)));
            }
            return(View(movie));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Reviewer,UserReview,MovieID,MovieTitle")] Review review)
        {
            if (id != review.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(review);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReviewExists(review.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction($"Details{"/" + review.MovieID}", "Movies"));
            }
            ViewData["thisMovieID"]    = review.MovieID;
            ViewData["thisMovieTitle"] = review.MovieTitle;
            return(View(review));
        }