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