Esempio n. 1
0
        public async Task <List <Season> > GetSeasons(CompetitionScopes scope)
        {
            List <short> seasons = await this.SessionQuery()
                                   .Where(x => x.CompetitionScopeID == scope)
                                   .GroupBy(x => x.Season.ID)
                                   .Select(x => x.Key)
                                   .ToListAsync();

            return(await this.Session.Query <Season>()
                   .Where(x => seasons.Contains(x.ID))
                   .OrderByDescending(x => x.StartDate)
                   .ToListAsync());
        }
Esempio n. 2
0
        public static Competition Create(CompetitionHeader header, Season season, CompetitionOrganisers organiser, CompetitionScopes scope, CompetitionFormats format,
                                         AgeGroups ageGroup, Genders gender, int associationID, string name,
                                         DateTime startDate,
                                         DateTime?endDate)
        {
            var data = new Competition
            {
                Season = season,
                CompetitionOrganiserID = organiser,
                CompetitionScopeID     = scope,
                CompetitionFormatID    = format,
                AgeGroupID             = ageGroup,
                GenderID      = gender,
                AssociationID = associationID,
                Name          = name,
                StartDate     = startDate,
                EndDate       = endDate
            };

            if (header != null)
            {
                data.CompetitionHeaderID = header.ID;
            }

            return(data);
        }