コード例 #1
0
        public async Task <IActionResult> Create([Bind("PlayerId,PlayerName,DateOfBirth,ContractId,HeightCm")] Players players)
        {
            if (ModelState.IsValid)
            {
                _context.Add(players);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(players));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("LeagueId,LeagueName,LeagueLevel,CountryId,NumberOfClplaces")] Leagues leagues)
        {
            if (ModelState.IsValid)
            {
                _context.Add(leagues);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Countries, "CountryId", "Countryname", leagues.CountryId);
            return(View(leagues));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("TitleId,TitleName,FederationId")] Titles titles)
        {
            if (ModelState.IsValid)
            {
                _context.Add(titles);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FederationId"] = new SelectList(_context.Federations, "FederationId", "FederationName", titles.FederationId);
            return(View(titles));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("ClubId,ClubName,Location,YearOfFoundation,LeagueId,Description")] Clubs clubs)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clubs);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LeagueId"] = new SelectList(_context.Leagues, "LeagueId", "LeagueName", clubs.LeagueId);
            return(View(clubs));
        }