public IActionResult Create([Bind("Id,MovieName,Genre,Price")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public IActionResult Create([Bind("Id,CustomerName,Email")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public IActionResult Create([Bind("Id,CustomerId,CommentText")] Comment comment) { if (ModelState.IsValid) { _context.Add(comment); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Set <Customer>(), "Id", "CustomerName", comment.CustomerId); return(View(comment)); }
public IActionResult Create([Bind("Id,MovieId,CustomerId")] MovieTransaction movieTransaction) { if (ModelState.IsValid) { _context.Add(movieTransaction); _context.SaveChanges(); 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)); }