public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Traveler).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TravelerExists(Traveler.OwnerID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Traveler = await _context.Traveler.FindAsync(id); if (Traveler != null) { _context.Traveler.Remove(Traveler); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Delay = await _context.Delay.FindAsync(id); if (Delay != null) { _context.Delay.Remove(Delay); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }