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