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

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

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

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

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

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