public async Task <IActionResult> Edit(int id, [Bind("Id,PROMatchNumber,MatchDescription,MatchDateTime,Arena,HomeTeam,AwayTeam,ScoreHomeTeam,ScoreAwayTeam,Ref1,Ref2,Ref3,Ref4,TournamentId,MatchNumberTSM,RefereeId")] PROMatch pROMatch) { if (id != pROMatch.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pROMatch); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PROMatchExists(pROMatch.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RefereeId"] = new SelectList(_context.Referee, "Id", "FullName", pROMatch.RefereeId); ViewData["TournamentId"] = new SelectList(_context.Tournament, "Id", "TournamentName", pROMatch.TournamentId); return(View(pROMatch)); }
public async Task <IActionResult> Create([Bind("Id,PROMatchNumber,MatchDescription,MatchDateTime,Arena,HomeTeam,AwayTeam,ScoreHomeTeam,ScoreAwayTeam,Ref1,Ref2,Ref3,Ref4,TournamentId,MatchNumberTSM,RefereeId")] PROMatch pROMatch) { if (ModelState.IsValid) { _context.Add(pROMatch); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["RefereeId"] = new SelectList(_context.Referee, "Id", "FullName", pROMatch.RefereeId); ViewData["TournamentId"] = new SelectList(_context.Tournament, "Id", "TournamentName", pROMatch.TournamentId); return(View(pROMatch)); }