public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } PowerAttorney = await _context.PowerAttorneys .Include(p => p.Manager).ThenInclude(m => m.Person) .FirstOrDefaultAsync(m => m.Id == id); if (PowerAttorney == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } PowerAttorney = await _context.PowerAttorneys.FindAsync(id); if (PowerAttorney != null) { PowerAttorney.IsDeleted = true; await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } PowerAttorney = await _context.PowerAttorneys .Include(p => p.Manager).FirstOrDefaultAsync(m => m.Id == id); if (PowerAttorney == null) { return(NotFound()); } ViewData["ManagerId"] = new SelectList(_context.Managers.Include(m => m.Person).OrderBy(m => m.Person.Surname).AsNoTracking(), "Id", "Name"); return(Page()); }