public async Task <IActionResult> Edit(int id, [Bind("ID,ShowingID,Seat,Booked")] ShowingSeat showingSeat) { if (id != showingSeat.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(showingSeat); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShowingSeatExists(showingSeat.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ShowingID"] = new SelectList(_context.Showings, "ID", "ID", showingSeat.ShowingID); return(View(showingSeat)); }
public async Task <IActionResult> Create([Bind("ID,ShowingID,Seat,Booked")] ShowingSeat showingSeat) { if (ModelState.IsValid) { _context.Add(showingSeat); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ShowingID"] = new SelectList(_context.Showings, "ID", "ID", showingSeat.ShowingID); return(View(showingSeat)); }