示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("GoalId,MatchId,PlayerId,TeamId")] Goal goal)
        {
            if (id != goal.GoalId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(goal);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GoalExists(goal.GoalId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MatchId"]  = new SelectList(_context.Matches, "MatchId", "MatchId", goal.MatchId);
            ViewData["PlayerId"] = new SelectList(_context.Players, "PlayerId", "PlayerId", goal.PlayerId);
            ViewData["TeamId"]   = new SelectList(_context.Teams, "TeamId", "TeamId", goal.TeamId);
            return(View(goal));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("StadiumId,StadiumName,SatdiumCapacity,CityId")] Stadium stadium)
        {
            if (id != stadium.StadiumId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(stadium);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StadiumExists(stadium.StadiumId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"] = new SelectList(_context.Cities, "CityId", "CityId", stadium.CityId);
            return(View(stadium));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("CoachId,CoachName,CoachImage")] Coach coach)
        {
            if (id != coach.CoachId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(coach);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CoachExists(coach.CoachId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(coach));
        }
        public async Task <IActionResult> Edit(int id, [Bind("NewsId,NewsTitle,NewsDate,NewsTime,NewsCategoryId,NewsImage,NewsWriter,NewsDescription,CoachId,LeagueId,TeamId,StadId,MatchId,PlayerId")] News news)
        {
            if (id != news.NewsId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(news);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NewsExists(news.NewsId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LeagueId"]       = new SelectList(_context.Leagues, "LeagueId", "LeagueId", news.LeagueId);
            ViewData["MatchId"]        = new SelectList(_context.Matches, "MatchId", "MatchId", news.MatchId);
            ViewData["NewsCategoryId"] = new SelectList(_context.Categories, "CategoryId", "CategoryId", news.NewsCategoryId);
            ViewData["PlayerId"]       = new SelectList(_context.Players, "PlayerId", "PlayerId", news.PlayerId);
            ViewData["StadId"]         = new SelectList(_context.Stadia, "StadiumId", "StadiumId", news.StadId);
            ViewData["TeamId"]         = new SelectList(_context.Teams, "TeamId", "TeamId", news.TeamId);
            return(View(news));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CityId,CityName,CountryId")] City city)
        {
            if (id != city.CityId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(city);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CityExists(city.CityId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Countries, "CountryId", "CountryId", city.CountryId);
            return(View(city));
        }
示例#6
0
        public async Task <IActionResult> Edit(int id, [Bind("MatchId,MatchDate,MatchTime,MatchStatus,StaduimId,LeagueId,MatchTeamName1,MatchTeamName2,MatchWeek,MatchTeamResult1,MatchTeamResult2")] Match match)
        {
            if (id != match.MatchId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(match);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MatchExists(match.MatchId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LeagueId"]  = new SelectList(_context.Leagues, "LeagueId", "LeagueId", match.LeagueId);
            ViewData["StaduimId"] = new SelectList(_context.Stadia, "StadiumId", "StadiumId", match.StaduimId);
            return(View(match));
        }
示例#7
0
        public async Task <IActionResult> Edit(int id, [Bind("MatchId,TeamId,Result1,MRedCard,MYelCard,MGoals")] Result result)
        {
            if (id != result.MatchId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(result);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ResultExists(result.MatchId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MatchId"] = new SelectList(_context.Matches, "MatchId", "MatchId", result.MatchId);
            ViewData["TeamId"]  = new SelectList(_context.Teams, "TeamId", "TeamId", result.TeamId);
            return(View(result));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PlayerId,PlayerName,PlayerPosition,TeamId,PlayerGoals,PlayerImage")] 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.Teams, "TeamId", "TeamId", player.TeamId);
            return(View(player));
        }
        public async Task <IActionResult> Edit(int id, [Bind("LeagueId,LeagueName,LeagueImage")] League league)
        {
            if (id != league.LeagueId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(league);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LeagueExists(league.LeagueId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(league));
        }
示例#10
0
        public async Task <IActionResult> Edit(int id, [Bind("TeamId,TeamName,TeamMatchPlayed,TeamWon,TeamDraw,TeamLost,TeamGoalFor,TeamGoalAg,TeamGoalOn,LeagueId,CoachId,TeamImage")] 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)));
            }
            ViewData["CoachId"]  = new SelectList(_context.Coaches, "CoachId", "CoachId", team.CoachId);
            ViewData["LeagueId"] = new SelectList(_context.Leagues, "LeagueId", "LeagueId", team.LeagueId);
            return(View(team));
        }