public async Task <IActionResult> Edit(int id, [Bind("Id,GameId,PlayerId")] GameStuff gameStuff)
        {
            if (id != gameStuff.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(gameStuff);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GameStuffExists(gameStuff.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PlayerId"] = new SelectList(_context.Set <Player>(), "Id", "Id", gameStuff.PlayerId);
            return(View(gameStuff));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Fecha,Difficult")] Match match)
        {
            if (id != match.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(match);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MatchExists(match.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(match));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Mail,Username")] 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(nameof(Index)));
            }
            return(View(player));
        }