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);//delete 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.RateList) .Include(c => c.Wine).SingleOrDefaultAsync(m => m.ID == id); if (Customer == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Customer = await _context.Customer .Include(c => c.RateList) .Include(c => c.Wine).SingleOrDefaultAsync(m => m.ID == id); if (Customer == null) { return(NotFound()); } ViewData["RateListID"] = new SelectList(_context.RateList, "ID", "Price"); //rate dropdown ViewData["WineID"] = new SelectList(_context.Wines, "ID", "Name"); //wine dropdown return(Page()); }