public async Task <IActionResult> Edit(int id, [Bind("LeagueId,LeagueName,LeagueLevel,CountryId,NumberOfClplaces")] Leagues leagues)
        {
            if (id != leagues.LeagueId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(leagues);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LeaguesExists(leagues.LeagueId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Countries, "CountryId", "Countryname", leagues.CountryId);
            return(View(leagues));
        }
        public async Task <IActionResult> Edit(int id, [Bind("TitleId,TitleName,FederationId")] Titles titles)
        {
            if (id != titles.TitleId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(titles);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TitlesExists(titles.TitleId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FederationId"] = new SelectList(_context.Federations, "FederationId", "FederationName", titles.FederationId);
            return(View(titles));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PlayerId,PlayerName,DateOfBirth,ContractId,HeightCm")] Players players)
        {
            if (id != players.PlayerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(players);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlayersExists(players.PlayerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(players));
        }
Example #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ClubId,ClubName,Location,YearOfFoundation,LeagueId,Description")] Clubs clubs)
        {
            if (id != clubs.ClubId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clubs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClubsExists(clubs.ClubId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LeagueId"] = new SelectList(_context.Leagues, "LeagueId", "LeagueName", clubs.LeagueId);
            return(View(clubs));
        }