public async Task <IActionResult> Create([Bind("Id,Name,Code")] Category category) { if (ModelState.IsValid) { _context.Add(category); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Create([Bind("Id,Name,ReleaseDate,Director,ContactEmailAddress,Languages,CategoryId")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Category_1, "Id", "Name", movie.CategoryId); return(View(movie)); }