public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Messages = await _context.Messages.FirstOrDefaultAsync(m => m.ID == id); if (Messages == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Messages = await _context.Messages.FindAsync(id); if (Messages != null) { _context.Messages.Remove(Messages); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }