public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Customer = await _context.Customers .Include(c => c.Seat) .Include(c => c.Ticket).FirstOrDefaultAsync(m => m.ID == id); if (Customer == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Customer = await _context.Customers.FindAsync(id); if (Customer != null) { _context.Customers.Remove(Customer); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Customer = await _context.Customers .Include(c => c.Seat) .Include(c => c.Ticket).FirstOrDefaultAsync(m => m.ID == id); if (Customer == null) { return(NotFound()); } ViewData["SeatID"] = new SelectList(_context.Seats, "ID", "SeatNumber"); ViewData["TicketID"] = new SelectList(_context.Tickets, "ID", "Number"); return(Page()); }