예제 #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Rule = await _context.Rule.FirstOrDefaultAsync(m => m.ID == id);

            if (Rule == null)
            {
                return(NotFound());
            }
            return(Page());
        }
예제 #2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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