public async Task <IActionResult> Edit(string id, [Bind("PlayerId,Player,Matches,Catches")] TopFielder topFielder) { if (id != topFielder.Player) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(topFielder); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TopFielderExists(topFielder.Player)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(topFielder)); }
public async Task <IActionResult> Create([Bind("PlayerId,Player,Matches,Catches")] TopFielder topFielder) { if (ModelState.IsValid) { _context.Add(topFielder); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(topFielder)); }