コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,MovieName,Plot,ReleaseYear,IsBlockBuster,CreatedDt")] 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("Id,Name,Gender,DOB,Bio,IsSuperstar,MovieFk")] Actor actor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(actor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MovieFk"] = new SelectList(_context.Set <Movie>(), "Id", "MovieName", actor.MovieFk);
            return(View(actor));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Sex,DOB,Bio,MovieFk")] Producer producer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(producer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MovieFk"] = new SelectList(_context.Movie, "Id", "MovieName", producer.MovieFk);
            return(View(producer));
        }