Exemple #1
0
        public async Task <IActionResult> Create([Bind("TeamName")] Team team)
        {
            if (ModelState.IsValid)
            {
                _context.Add(team);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(team));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,MinutesPlayed")] Referee referee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(referee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(referee));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("Id,Name,YellowCards,RedCards,MinutesPlayed", "TeamId")] Manager manager)
        {
            if (ModelState.IsValid)
            {
                _context.Add(manager);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TeamId"] = new SelectList(_context.Set <Team>(), "Id", "Name", "TeamName");
            return(View(manager));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,HouseTeamManagerId,AwayTeamManagerId,RefereeId,Date")] Match match)
        {
            if (ModelState.IsValid)
            {
                _context.Add(match);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AwayTeamManagerId"]  = new SelectList(_context.Manager, "Id", "Name", match.AwayTeamManagerId);
            ViewData["HouseTeamManagerId"] = new SelectList(_context.Manager, "Id", "Name", match.HouseTeamManagerId);
            ViewData["RefereeId"]          = new SelectList(_context.Referee, "Id", "Name", match.RefereeId);
            return(View(match));
        }