Exemple #1
0
        public ActionResult Schedule(int id)
        {
            var viewModel = new CompetitionEventDetailsVM();

            viewModel.CompetitionEventDetailsList = _competitionEventDetailsRepository.GetWhere(x => x.CompetitionID == id).ToList();

            viewModel.CompetitionEventDetailsList.Sort((a, b) => a.StartTime.CompareTo(b.StartTime));

            return(View(viewModel));
        }
        public ActionResult Schedule(int?id)
        {
            var competitionEventDetailsVM = new CompetitionEventDetailsVM();

            competitionEventDetailsVM.CompetitionEventList = new List <CompetitionEvents>();
            competitionEventDetailsVM.CompetitionEventList = _comeptitionEventsRepository.GetWhere(x => x.CompetitionID == id.Value).ToList();

            competitionEventDetailsVM.Competition = new Competition {
                ID = (int)id
            };

            competitionEventDetailsVM.CompetitionEventDetailsList = _competitionEventDetailsRepository.GetWhere(x => x.CompetitionID == id.Value).ToList();
            competitionEventDetailsVM.CompetitionEventDetailsList.Sort((a, b) => a.StartTime.CompareTo(b.StartTime));

            competitionEventDetailsVM.EventsList = new List <Event>();
            foreach (var item in competitionEventDetailsVM.CompetitionEventList)
            {
                competitionEventDetailsVM.EventsList.Add(_eventsRepository.GetWhere(x => x.ID == item.EventID).FirstOrDefault());
            }

            return(View(competitionEventDetailsVM));
        }