示例#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"));
        }