コード例 #1
0
        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());
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
        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());
        }