public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Customer = await _context.Customer .Include(c => c.Employee) .Include(c => c.Flower).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.Customer.FindAsync(id); if (Customer != null) { _context.Customer.Remove(Customer); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Customer = await _context.Customer .Include(c => c.Employee) .Include(c => c.Flower).FirstOrDefaultAsync(m => m.ID == id); if (Customer == null) { return(NotFound()); } ViewData["EmployeeID"] = new SelectList(_context.Employee, "ID", "Name"); ViewData["FlowerID"] = new SelectList(_context.Flower, "ID", "Name"); return(Page()); }