예제 #1
0
        public async Task <IActionResult> Create([Bind("ID,Title,ReleaseDate,Genre,Price,Rating,PosterURL")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movie);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(movie));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Reviewer,UserReview,MovieID,MovieTitle")] Review review)
        {
            if (ModelState.IsValid)
            {
                _context.Add(review);
                await _context.SaveChangesAsync();

                return(RedirectToAction($"Details{"/" + review.MovieID}", "Movies"));
            }
            ViewData["thisMovieID"]    = review.MovieID;
            ViewData["thisMovieTitle"] = review.MovieTitle;
            return(View(review));
        }