Beispiel #1
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);
        }
        public IActionResult Edit(int id)
        {
            if (id == 0)
            {
                return(NotFound());
            }

            var team = _teamManagement.GetTeamById(id);

            if (team == null)
            {
                return(NotFound());
            }

            TeamVm viewModel = new TeamVm(team);
            var    section   = _sectionManagement.GetSectionById(team.SectionId);

            viewModel.SectionId          = section.SectionId;
            viewModel.Section            = section;
            viewModel.Section.Tournament = _tournamentManagement.GetTournamentById(section.TournamentId);

            return(View("TeamAdminForm", viewModel));
        }