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

            Peat = await _context.Peat.FirstOrDefaultAsync(m => m.peatId == id);

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

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

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

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