Exemplo n.º 1
0
        public ActionResult CreateNewMatch(TournamentPlanningView view)
        {
            TournamentAccessRepository rep = new TournamentAccessRepository();
            Guid match_id = rep.CreateTournamentMatch(view.SelectedTournamentNewMatch, view.SelectedTournamentID);

            if (match_id != Guid.Empty)
            {
                return(RedirectToAction("Planning", new { id = view.SelectedTournamentID, message = "Match created successfully!" }));
            }
            else
            {
                return(RedirectToAction("Planning", new { id = view.SelectedTournamentID, message = "There was an error creating match!" }));
            }
        }
Exemplo n.º 2
0
        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));
        }