public async Task <IActionResult> Create([Bind("GenreID,GenreName")] GenresModel genresModel) { if (ModelState.IsValid) { _context.Add(genresModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(genresModel)); }
public async Task <IActionResult> Create([Bind("CustomerID,CustomerName,CustomerEmail,CustomerPhoneNumber")] CustomersModel customersModel) { if (ModelState.IsValid) { _context.Add(customersModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customersModel)); }
public async Task <IActionResult> Create([Bind("MovieID,MovieTitle,YearReleased,Director,GenresModelID")] MoviesModel moviesModel) { if (ModelState.IsValid) { _context.Add(moviesModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["GenresModelID"] = new SelectList(_context.Genres, "GenreID", "GenreID", moviesModel.GenresModelID); return(View(moviesModel)); }
public async Task <IActionResult> CheckInMovie(int?id) { if (id == null) { return(NotFound()); } var moviesModel = await _context.Movies .Include(m => m.GenresModel) .SingleOrDefaultAsync(m => m.MovieID == id); moviesModel.IsCheckedOut = false; await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Movies")); }