Beispiel #1
0
        public IEnumerable <IExposableTeam> GetTeamsOfSerie(Guid sereisId)
        {
            var series       = DomainService.FindSeriesById(sereisId);
            var teamsOfSerie = series.TeamIds;

            return(teamsOfSerie.Select(teamId => DomainService.FindTeamById(teamId)).ToList());
        }
Beispiel #2
0
        public void ScheduleGenerator(Guid seriesId)
        {
            var schedule = new Schedule();
            var series   = DomainService.FindSeriesById(seriesId);

            schedule.GenerateSchedule(series);
            DomainService.AddMatches(series.Schedule);
            repository.SaveData();
        }
Beispiel #3
0
 public IEnumerable <Match> Search(string searchText, StringComparison comparison
                                   = StringComparison.InvariantCultureIgnoreCase)
 {
     return(this.GetAll().Where(x =>
                                x.Id != Guid.Empty && x.SeriesId != Guid.Empty &&
                                x.HomeTeamId != Guid.Empty && x.AwayTeamId != Guid.Empty
                                &&
                                (DomainService.FindSeriesById(x.SeriesId).SeriesName.ToString().Contains(searchText, comparison) ||
                                 DomainService.FindTeamById(x.HomeTeamId).Name.ToString().Contains(searchText, comparison) ||
                                 DomainService.FindTeamById(x.AwayTeamId).Name.ToString().Contains(searchText, comparison) ||
                                 x.Location.ToString().Contains(searchText, comparison) ||
                                 x.MatchDate.ToString().Contains(searchText, comparison))));
 }
Beispiel #4
0
        public void RemoveTeamFromSeries(Guid seriesId, Guid teamId)
        {
            var series = DomainService.FindSeriesById(seriesId);

            if (series.TeamIds.Contains(teamId))
            {
                series.TeamIds.Remove(teamId);
            }
            else
            {
                throw new ArgumentException($"Can not remove team \"{DomainService.FindTeamById(teamId)}\"."
                                            + $" Team doesn't exist in series \"{DomainService.FindSeriesById(seriesId)}\".");
            }
        }