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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(movie));
        }
        public async Task <IActionResult> Create([Bind("ActorID,Name, BirthName, BirthDate, HomeTown")] Actor actor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(actor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(actor));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("MovieRoleID,ActorID,MovieID,Character")] MovieRole movieRole)
        {
            if (ModelState.IsValid)
            {
                _context.Add(movieRole);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ActorID"] = new SelectList(_context.Actor, "ActorID", "Name", movieRole.ActorID);
            ViewData["MovieID"] = new SelectList(_context.Movie, "ID", "Genre", movieRole.MovieID);
            return(View(movieRole));
        }