Example #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            Student = await db.Items.FirstOrDefaultAsync(m => m.ID == id);

            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Student = await db.Items.FindAsync(id);

            if (Student != null)
            {
                db.Items.Remove(Student);
                await db.SaveChangesAsync();
            }

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