예제 #1
0
        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());
        }
예제 #2
0
        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"));
        }
예제 #3
0
        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());
        }