public async Task <IActionResult> OnPostDeleteAsync(int id) { var contact = await _context.Customer.FindAsync(id); if (contact != null) { _context.Customer.Remove(contact); await _context.SaveChangesAsync(); } return(RedirectToPage()); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Customer.Add(Customer); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }