public async Task <IActionResult> Create([Bind("CustomerId,CustomerName,CustomerPhoneNumber")] CustomerModel customerModel) { if (ModelState.IsValid) { _context.Add(customerModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customerModel)); }
public async Task <IActionResult> Create([Bind("MovieId,MovieName,MovieDescription,GenreId")] MovieModel movieModel) { if (ModelState.IsValid) { _context.Add(movieModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["GenreId"] = new SelectList(_context.Genres, "GenreId", "GenreId", movieModel.GenreId); return(View(movieModel)); }