public ActionResult MatchSchedule(string id) { try { TournamentAccessRepository rep = new TournamentAccessRepository(); List <TeamApplication> teamApplications = rep.GetAllApprovedTeamApplicationsByTournamentID(Guid.Parse(id)); List <Match> matches = rep.GetTournamentMatches(Guid.Parse(id)); foreach (var match in matches) { foreach (var teamApp in teamApplications) { if (match.TeamApplicationOne.ApplicationID == teamApp.ApplicationID) { match.TeamApplicationOne.Organization = teamApp.Organization; } if (match.TeamApplicationTwo.ApplicationID == teamApp.ApplicationID) { match.TeamApplicationTwo.Organization = teamApp.Organization; } } } return(View("MatchSchedule", matches)); } catch { } return(View()); }
public ActionResult Planning(string id, string message) //id = Tournament ID { ViewData["Message"] = message; TournamentPlanningView view = new TournamentPlanningView(); if (id != null && id.Trim() != "") { view.SelectedTournamentID = Guid.Parse(id); } List <TeamApplication> teamApplications = null;; TournamentAccessRepository tourRep = new TournamentAccessRepository(); List <Tournament> tournaments = tourRep.GetAllTournaments(); if (view.SelectedTournamentID != Guid.Empty) { teamApplications = tourRep.GetAllApprovedTeamApplicationsByTournamentID(view.SelectedTournamentID); view.SelectedTournamentMatches = tourRep.GetTournamentMatches(view.SelectedTournamentID); } else { teamApplications = new List <TeamApplication>(); view.SelectedTournamentMatches = new List <Match>(); } view.SelectedTournamentTeamApplications = new List <SelectListItem>(); foreach (var item in teamApplications) { view.SelectedTournamentTeamApplications.Add(new SelectListItem { Value = item.ApplicationID.ToString(), Text = item.Organization.Name + " - " + item.TeamName + "(" + item.Category + ")" }); } view.Tournaments = new List <SelectListItem>(); foreach (var item in tournaments) { view.Tournaments.Add(new SelectListItem { Text = item.TournamentName, Value = item.TournamentID.ToString() }); } return(View(view)); }