public async Task <IActionResult> Edit(int id, [Bind("AtletaId,Nome,Idade,Nacionalidade")] Atleta atleta) { if (id != atleta.AtletaId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(atleta); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AtletaExists(atleta.AtletaId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(atleta)); }
public async Task <IActionResult> Edit(int id, [Bind("PlacarId,AtletaId,Pontos,Data")] Placar placar) { if (id != placar.PlacarId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(placar); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlacarExists(placar.PlacarId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AtletaId"] = new SelectList(_context.Atleta, "AtletaId", "Nome", placar.AtletaId); return(View(placar)); }