示例#1
0
        public async Task <IActionResult> Create([Bind("CoachId,CoachName,CoachImage")] Coach coach)
        {
            if (ModelState.IsValid)
            {
                _context.Add(coach);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(coach));
        }
        public async Task <IActionResult> Create([Bind("LeagueId,LeagueName,LeagueImage")] League league)
        {
            if (ModelState.IsValid)
            {
                _context.Add(league);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(league));
        }
示例#3
0
        public async Task <IActionResult> Create([Bind("CategoryId,CategoryName")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("StadiumId,StadiumName,SatdiumCapacity,CityId")] Stadium stadium)
        {
            if (ModelState.IsValid)
            {
                _context.Add(stadium);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"] = new SelectList(_context.Cities, "CityId", "CityId", stadium.CityId);
            return(View(stadium));
        }
        public async Task <IActionResult> Create([Bind("CityId,CityName,CountryId")] City city)
        {
            if (ModelState.IsValid)
            {
                _context.Add(city);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Countries, "CountryId", "CountryId", city.CountryId);
            return(View(city));
        }
        public async Task <IActionResult> Create([Bind("PlayerId,PlayerName,PlayerPosition,TeamId,PlayerGoals,PlayerImage")] Player player)
        {
            if (ModelState.IsValid)
            {
                _context.Add(player);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"] = new SelectList(_context.Teams, "TeamId", "TeamId", player.TeamId);
            return(View(player));
        }
示例#7
0
        public async Task <IActionResult> Create([Bind("MatchId,MatchDate,MatchTime,MatchStatus,StaduimId,LeagueId,MatchTeamName1,MatchTeamName2,MatchWeek,MatchTeamResult1,MatchTeamResult2")] Match match)
        {
            if (ModelState.IsValid)
            {
                _context.Add(match);
                await _context.SaveChangesAsync();

                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));
        }
示例#8
0
        public async Task <IActionResult> Create([Bind("MatchId,TeamId,Result1,MRedCard,MYelCard,MGoals")] Result result)
        {
            if (ModelState.IsValid)
            {
                _context.Add(result);
                await _context.SaveChangesAsync();

                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));
        }
示例#9
0
        public async Task <IActionResult> Create([Bind("TeamId,TeamName,TeamMatchPlayed,TeamWon,TeamDraw,TeamLost,TeamGoalFor,TeamGoalAg,TeamGoalOn,LeagueId,CoachId,TeamImage")] Team team)
        {
            if (ModelState.IsValid)
            {
                _context.Add(team);
                await _context.SaveChangesAsync();

                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));
        }
示例#10
0
        public async Task <IActionResult> Create([Bind("GoalId,MatchId,PlayerId,TeamId")] Goal goal)
        {
            if (ModelState.IsValid)
            {
                _context.Add(goal);
                await _context.SaveChangesAsync();

                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));
        }
        public async Task <IActionResult> Create([Bind("NewsId,NewsTitle,NewsDate,NewsTime,NewsCategoryId,NewsImage,NewsWriter,NewsDescription,CoachId,LeagueId,TeamId,StadId,MatchId,PlayerId")] News news)
        {
            if (ModelState.IsValid)
            {
                _context.Add(news);
                await _context.SaveChangesAsync();

                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));
        }