コード例 #1
0
ファイル: Edit.cshtml.cs プロジェクト: vdhplk/WebDB_MIA
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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

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

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