Ejemplo n.º 1
0
    private async Task <RaceWithOptionsViewModel> CreateClubRaceAsync(string clubInitials)
    {
        var club = await _coreClubService.GetMinimalClub(clubInitials);

        var model = new RaceWithOptionsViewModel
        {
            ClubId           = club.Id,
            FleetOptions     = await _coreClubService.GetActiveFleets(club.Id),
            SeriesOptions    = await _coreSeriesService.GetAllSeriesAsync(club.Id, DateTime.Today, false),
            ScoreCodeOptions = (await _coreScoringService.GetScoreCodesAsync(club.Id))
                               .OrderBy(s => s.Name).ToList(),
            CompetitorOptions          = new List <Competitor>(),
            CompetitorBoatClassOptions = (await _coreClubService.GetAllBoatClasses(club.Id)).OrderBy(c => c.Name),
            Date                = DateTime.Today,
            Weather             = await _weatherService.GetCurrentWeatherForClubAsync(club),
            WeatherIconOptions  = GetWeatherIconOptions(),
            ClubHasCompetitors  = await _coreClubService.DoesClubHaveCompetitors(club.Id),
            NeedsLocalDate      = true,
            UseAdvancedFeatures = club.UseAdvancedFeatures ?? false
        };

        return(model);
    }