public IActionResult Create([Bind("Id,Title,ReleaseDate,Genre,Price")] Movie movie)
 {
     if (ModelState.IsValid)
     {
         _context.Add(movie);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(movie));
 }
示例#2
0
 public async Task<IActionResult> Create([Bind("Id,Title,ReleaseDate,Genre,Price")] Movie movie)
 {
     if (ModelState.IsValid)
     {
         _context.Add(movie);
         await _context.SaveChangesAsync();
         return RedirectToAction(nameof(Index));
     }
     return View(movie);
 }