public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Continent,Foundation")] Country country) { if (id != country.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(country); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CountryExists(country.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(country)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,LastName,FirstName,BornDate,Height,Weight,CountryID")] Player player) { if (id != player.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(player); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlayerExists(player.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["CountryID"] = new SelectList(_context.Countries, "ID", "ID", player.CountryID); return(View(player)); }