Exemplo n.º 1
0
        public IActionResult SaveFixture(int fixtureId)
        {
            var       fixture   = _fixtureManagement.GetFixtureById(fixtureId);
            FixtureVm viewModel = new FixtureVm(fixture);

            viewModel.TournamentSquashVenueId = fixture.TournamentSquashVenueId;
            viewModel.TournamentSquashVenue   = _tournamentSquashVenueManagement.GetTournamentSquashVenueById(fixture.TournamentSquashVenueId);
            viewModel.Section         = _sectionManagement.GetSectionById(viewModel.SectionId);
            viewModel.AvailableTeams  = _teamManagement.GetTeamsForSection(viewModel.SectionId);
            viewModel.AvailableVenues = _tournamentSquashVenueManagement.GetAvailableTournamentSquashVenues(viewModel.Section.TournamentId);

            return(View("FixtureAdminForm", viewModel));
        }
Exemplo n.º 2
0
        public FixtureIndexVm FixtureIndexViewModel(int sectionId)
        {
            //clean up here please :-)

            FixtureIndexVm viewModel = new FixtureIndexVm();

            viewModel.SectionVm            = new SectionVm(_sectionManagement.GetSectionById(sectionId));
            viewModel.SectionVm.Tournament = _tournamentManagement.GetTournamentById(viewModel.SectionVm.TournamentId);


            foreach (var fixture in GetFixturesForSection(sectionId))
            {
                FixtureVm fixtureVm = new FixtureVm(fixture);
                fixtureVm.TeamA   = _teamManagement.GetTeamById(fixture.TeamAId);
                fixtureVm.TeamB   = _teamManagement.GetTeamById(fixture.TeamBId);
                fixtureVm.Section = _sectionManagement.GetSectionById(fixture.SectionId);
                fixtureVm.TournamentSquashVenue = _tournamentSquashVenueManagement.GetTournamentSquashVenueById(fixture.TournamentSquashVenueId);

                viewModel.FixtureVms.Add(fixtureVm);
            }

            return(viewModel);
        }