public async Task <IActionResult> Edit(string id, [Bind("TeamName", "Id")] Team team) { // Important: Not intended to be used..... if (id != team.TeamName) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(team); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamExists(team.TeamName)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(team)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,MinutesPlayed")] Referee referee) { if (id != referee.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(referee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RefereeExists(referee.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(referee)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,YellowCards,RedCards,MinutesPlayed", "TeamId")] Manager manager) { if (id != manager.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(manager); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ManagerExists(manager.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TeamId"] = new SelectList(_context.Set <Team>(), "Id", "Name", "TeamName"); return(View(manager)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,HouseTeamManagerId,AwayTeamManagerId,RefereeId,Date")] Match match) { if (id != match.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(match); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MatchExists(match.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AwayTeamManagerId"] = new SelectList(_context.Manager, "Id", "Name", match.AwayTeamManagerId); ViewData["HouseTeamManagerId"] = new SelectList(_context.Manager, "Id", "Name", match.HouseTeamManagerId); ViewData["RefereeId"] = new SelectList(_context.Referee, "Id", "Name", match.RefereeId); return(View(match)); }