public ActionResult EditMatch(int id) { Match match = matchProvider.GetMatchById(id); if (match == null) { log.Error("Controller: Match, Action: EditMatch Don't GetMatchById"); return(RedirectToAction("InfoError", "Error")); } SelectList sports = new SelectList(betListProvider.GetSports(), "SportId", "Name", match.SportId); if (sports == null) { log.Error("Controller: Match, Action: EditMatch Don't GetSports"); return(RedirectToAction("InfoError", "Error")); } ViewBag.Sports = sports; int selected = match.Tournament.TournamentId; SelectList tournaments = new SelectList(betListProvider.GetTournamentes(), "TournamentId", "Name", selected); if (tournaments == null) { log.Error("Controller: Match, Action: EditMatch Don't GetTournamentes"); return(RedirectToAction("InfoError", "Error")); } ViewBag.Tournaments = betListProvider.GetTournamentes(); IReadOnlyList <Team> teamsAll = teamProvider.GetTeamsAll(); if (teamsAll == null) { log.Error("Controller: Match, Action: EditMatch Don't GetTeamsAll"); return(RedirectToAction("InfoError", "Error")); } selected = match.Teams[0].TeamId; SelectList teamsHome = new SelectList(teamsAll, "TeamId", "Name", selected); ViewBag.TeamsHome = teamsHome; selected = match.Teams[1].TeamId; SelectList teamsGuest = new SelectList(teamsAll, "TeamId", "Name", selected); ViewBag.TeamsGuest = teamsGuest; selected = match.Result.ResultId; SelectList results = new SelectList(matchProvider.GetResultsAll(), "ResultId", "Name", selected); if (results == null) { log.Error("Controller: Match, Action: EditMatch Don't GetResultsAll"); return(RedirectToAction("InfoError", "Error")); } ViewBag.Results = results; return(View(match)); }
public ActionResult ShowCoefficient(int matchId) { ViewBag.Match = matchId; Match match = matchProvider.GetMatchById(matchId); if (match == null) { log.Error("Controller: Sort, Action: ShowCoefficient Don't GetMatchById"); return(RedirectToAction("InfoError", "Error")); } ViewBag.MatchDate = match.Date; IReadOnlyList <Event> events = matchProvider.GetEventByMatch(matchId); if (events == null) { log.Error("Controller: Sort, Action: ShowCoefficient Don't GetEventByMatch"); return(RedirectToAction("InfoError", "Error")); } return(View(events)); }
public void GetMatchById_MustThrow_IndexOutOfRangeException_If_IdIsNegative() { Assert.ThrowsAsync <IndexOutOfRangeException>(() => _matchProvider.GetMatchById(-1)); }