public async Task <IActionResult> Edit(int id, [Bind("CustomerId,CustomerName,CustomerPhoneNumber")] CustomerModel customerModel) { if (id != customerModel.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customerModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerModelExists(customerModel.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customerModel)); }
public async Task <IActionResult> Edit(int id, [Bind("MovieId,MovieName,MovieDescription,GenreId")] MovieModel movieModel) { if (id != movieModel.MovieId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(movieModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieModelExists(movieModel.MovieId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(movieModel)); }
public async Task <IActionResult> CheckIn(int id, [Bind("RentalId,MovieId,CustomerId,RentalDate,DueDate,ReturnDate")] RentalRecordModel rentalRecordModel) { if (id != rentalRecordModel.RentalId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rentalRecordModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RentalRecordModelExists(rentalRecordModel.RentalId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "CustomerId", rentalRecordModel.CustomerId); ViewData["MovieId"] = new SelectList(_context.Movies, "MovieId", "MovieId", rentalRecordModel.MovieId); return(View(rentalRecordModel)); }