public async Task <IActionResult> Create([Bind("Id,TeamName,CaptainId")] Team team) { if (ModelState.IsValid) { _context.Add(team); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CaptainId"] = new SelectList(_context.Players, "Id", "Email", team.CaptainId); return(View(team)); }
public async Task <IActionResult> Create([Bind("Id,NickName,Email,PhoneNumber,FirstName,LastName,Level,TeamId")] Player player) { if (ModelState.IsValid) { _context.Add(player); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TeamId"] = new SelectList(_context.Teams, "Id", "TeamName", player.TeamId); return(View(player)); }
public async Task <IActionResult> Create([Bind("Id,GameDateTime,TeamDefendantId,TeamAttackerId")] Game game) { if (ModelState.IsValid) { _context.Add(game); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TeamAttackerId"] = new SelectList(_context.Teams, "Id", "TeamName", game.TeamAttackerId); ViewData["TeamDefendantId"] = new SelectList(_context.Teams, "Id", "TeamName", game.TeamDefendantId); return(View(game)); }