// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Exams.Add(Exam); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } Exam = await _context.Exams.FindAsync(id); if (Exam != null) { _context.Exams.Remove(Exam); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }