예제 #1
0
        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));
        }
예제 #2
0
        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));
        }