public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } VisitorBadge = await _context.VisitorBadge .Include(v => v.Site).SingleOrDefaultAsync(m => m.BadgeId == id); if (VisitorBadge == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } VisitorBadge = await _context.VisitorBadge.FindAsync(id); if (VisitorBadge != null) { _context.VisitorBadge.Remove(VisitorBadge); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } VisitorBadge = await _context.VisitorBadge .Include(v => v.Site).SingleOrDefaultAsync(m => m.BadgeId == id); if (VisitorBadge == null) { return(NotFound()); } ViewData["SiteId"] = new SelectList(_context.Site, "SiteId", "City"); return(Page()); }