public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Payroll = await _context.Payrolls .Include(p => p.Employee).FirstOrDefaultAsync(m => m.ID == id); if (Payroll == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Payroll = await _context.Payrolls.FindAsync(id); if (Payroll != null) { _context.Payrolls.Remove(Payroll); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Payroll = await _context.Payrolls .Include(p => p.Employee).FirstOrDefaultAsync(m => m.ID == id); if (Payroll == null) { return(NotFound()); } ViewData["EmployeeID"] = new SelectList(_context.Employees, "ID", "ID"); return(Page()); }