public async Task <IActionResult> Create(GameCreateViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(viewModel.gameModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(viewModel));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,TeamId,Name,AvgScore,AvgOppScore,AvgOffReb,AvgDefReb,AvgStl,AvgBlk,AvgAst,Seed")] TeamModel teamModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(teamModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(teamModel));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("Id,Name")] BracketModel bracketModel)
        {
            bracketModel.Games        = new List <GameModel>(63);
            bracketModel.CorrectPicks = 0;
            if (ModelState.IsValid)
            {
                _context.Add(bracketModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Pick", "Bracket", new { bracketId = bracketModel.Id, bracketPosition = 0 }));
            }
            return(View(bracketModel));
        }