Пример #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Randomuser = await _context.Randomuser.FirstOrDefaultAsync(m => m.Id == id);

            if (Randomuser == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Пример #2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Randomuser = await _context.Randomuser.FindAsync(id);

            if (Randomuser != null)
            {
                _context.Randomuser.Remove(Randomuser);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }