public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } AgencyCompany = await _context.AgencyCompanies .Include(a => a.Person).FirstOrDefaultAsync(m => m.Id == id); if (AgencyCompany == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } AgencyCompany = await _context.AgencyCompanies .Include(a => a.Person).FirstOrDefaultAsync(m => m.Id == id); if (AgencyCompany == null) { return(NotFound()); } ViewData["PersonId"] = new SelectList(_context.People.Where(p => p.IsEmployee).AsNoTracking(), "Id", "SurnameInitials"); return(Page()); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } AgencyCompany = await _context.AgencyCompanies.FindAsync(id); if (AgencyCompany != null) { AgencyCompany.IsDeleted = true; await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }