Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("SeasonId,LeagueId,Name,IsActive")] Season season)
        {
            if (id != season.SeasonId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(season);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SeasonExists(season.SeasonId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(season));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("TeamId,SeasonId,Name")] 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));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("LeagueId,Name")] 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));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("MatchId,SeasonId,MatchDate,Location,MatchDetail,Season")] 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)));
            }

            //we don't pass the season information along, so go get it again.
            if (match.Season == null)
            {
                match.Season = _context.Matches
                               .Include(m => m.Season)
                               .ThenInclude(s => s.Teams)
                               .Where(m => m.MatchId == id)
                               .First().Season;
            }

            return(View(match));
        }