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

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

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

            WineMaster = await _context.WineMasters.FindAsync(id);

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

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