public async Task <IActionResult> Edit(int id, [Bind("Id,TournamentName,TournamentDate,AwayHomeGame")] RegisterTournament registerTournament) { if (id != registerTournament.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(registerTournament); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RegisterTournamentExists(registerTournament.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(registerTournament)); }
public async Task <IActionResult> Create([Bind("Id,TournamentName,TournamentDate,AwayHomeGame")] RegisterTournament registerTournament) { if (ModelState.IsValid) { _context.Add(registerTournament); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(registerTournament)); }