public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Cart = await _context.Carts.FirstOrDefaultAsync(m => m.Id == id); if (Cart == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Cart = await _context.Carts.FindAsync(id); if (Cart != null) { _context.Carts.Remove(Cart); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }