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