public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Booking = await _context.Bookings .Include(b => b.BarberStaff) .Include(b => b.Customer).FirstOrDefaultAsync(m => m.ID == id); if (Booking == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Booking = await _context.Bookings.FindAsync(id); if (Booking != null) { _context.Bookings.Remove(Booking); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Booking = await _context.Bookings .Include(b => b.BarberStaff) .Include(b => b.Customer).FirstOrDefaultAsync(m => m.ID == id); if (Booking == null) { return(NotFound()); } ViewData["BarberStaffID"] = new SelectList(_context.BarberStaffs, "ID", "Name"); ViewData["CustomerID"] = new SelectList(_context.Customers, "ID", "Name"); return(Page()); }