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