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")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } #pragma warning disable CS8601 // Possible null reference assignment. Customer = await _context.Customer.FindAsync(id); #pragma warning restore CS8601 // Possible null reference assignment. if (Customer != null) { _context.Customer.Remove(Customer); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }