public IActionResult Edit(int id, [Bind("Id,MovieId,CustomerId")] MovieTransaction movieTransaction) { if (id != movieTransaction.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(movieTransaction); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MovieTransactionExists(movieTransaction.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "CustomerName", movieTransaction.CustomerId); ViewData["MovieId"] = new SelectList(_context.Movie, "Id", "MovieName", movieTransaction.MovieId); return(View(movieTransaction)); }
public IActionResult Edit(int id, [Bind("Id,CustomerId,CommentText")] Comment comment) { if (id != comment.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(comment); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CommentExists(comment.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Set <Customer>(), "Id", "CustomerName", comment.CustomerId); return(View(comment)); }
public IActionResult Edit(int id, [Bind("Id,MovieName,Genre,Price")] Movie movie) { if (id != movie.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(movie); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MovieExists(movie.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public IActionResult Edit(int id, [Bind("Id,CustomerName,Email")] Customer customer) { if (id != customer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }