public async Task <IActionResult> Create([Bind("Id,TournamentName,TournamentDateTime,TournamentTypeId,GameId,GameId1,GameId2,GameId3,GameId4,GameId5,GameId6,GameId7,GameId8,GameId9,GameId10,GameId11,GameId12,GameId13,GameId14")] Tornament tornament) { if (ModelState.IsValid) { _context.Add(tornament); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(ListTournaments))); } ViewData["GameId"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId); ViewData["GameId9"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId9); ViewData["GameId10"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId10); ViewData["GameId11"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId11); ViewData["GameId12"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId12); ViewData["GameId13"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId13); ViewData["GameId14"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId14); ViewData["GameId1"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId1); ViewData["GameId2"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId2); ViewData["GameId3"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId3); ViewData["GameId4"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId4); ViewData["GameId5"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId5); ViewData["GameId6"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId6); ViewData["GameId7"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId7); ViewData["GameId8"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId8); ViewData["TournamentTypeId"] = new SelectList(_context.Set <TournamentType>(), "Id", "TournamentTypeName", tornament.TournamentTypeId); return(View(tornament)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,TournamentName,TournamentDateTime,TournamentTypeId,GameId,GameId1,GameId2,GameId3,GameId4,GameId5,GameId6,GameId7,GameId8,GameId9,GameId10,GameId11,GameId12,GameId13,GameId14")] Tornament tornament) { if (id != tornament.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tornament); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TornamentExists(tornament.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(ListTournaments))); } ViewData["GameId"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId); ViewData["GameId9"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId9); ViewData["GameId10"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId10); ViewData["GameId11"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId11); ViewData["GameId12"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId12); ViewData["GameId13"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId13); ViewData["GameId14"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId14); ViewData["GameId1"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId1); ViewData["GameId2"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId2); ViewData["GameId3"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId3); ViewData["GameId4"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId4); ViewData["GameId5"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId5); ViewData["GameId6"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId6); ViewData["GameId7"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId7); ViewData["GameId8"] = new SelectList(_context.Game, "Id", "GameNumber", tornament.GameId8); ViewData["TournamentTypeId"] = new SelectList(_context.Set <TournamentType>(), "Id", "TournamentTypeName", tornament.TournamentTypeId); return(View(tornament)); }