Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("NbaTeamID,NbaTeamName,NbaTeamConference")] NbaTeam nbaTeam)
        {
            if (id != nbaTeam.NbaTeamID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(nbaTeam);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NbaTeamExists(nbaTeam.NbaTeamID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(nbaTeam));
        }
        public async Task <IActionResult> Edit(int id, [Bind("TeamId,TeamName,TeamChampionships,TeamFinaslAppearances,TeamConference")] Team team)
        {
            if (id != team.TeamId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(team);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeamExists(team.TeamId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(team));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("CurrentPlayerID,CurrentPlayerName,CurrentPlayerPosition,CurrentPlayerDOB,NbaTeamID")] CurrentPlayer currentPlayer)
        {
            if (id != currentPlayer.CurrentPlayerID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(currentPlayer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CurrentPlayerExists(currentPlayer.CurrentPlayerID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["NbaTeamID"] = new SelectList(_context.NbaTeams, "NbaTeamID", "NbaTeamName", currentPlayer.NbaTeamID);
            return(View(currentPlayer));
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, [Bind("PlayerId,TeamId,LastName,FirstName,Position,PlayerPointsScored,AllStarGames,VideoLink,PhotoLink")] Player player)
        {
            if (id != player.PlayerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(player);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlayerExists(player.PlayerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"] = new SelectList(_context.Team, "TeamId", "TeamId", player.TeamId);
            return(View(player));
        }