示例#1
0
        private async Task IncludeLastPolePositionResult(Race dbNextRace, NextRaceSummary apiNextRace)
        {
            var dbLastPolePositionResult = await context.Grids
                                           .Include(g => g.Race)
                                           .Where(g => g.Race.TrackId == dbNextRace.TrackId && g.Race.Date < dbNextRace.Date && g.StartingPosition == "1")
                                           .Include(g => g.Entry)
                                           .ThenInclude(e => e.Driver)
                                           .ThenInclude(d => d.Nationality)
                                           .OrderByDescending(g => g.Race.Date)
                                           .FirstAsync();

            apiNextRace.LastPolePositionLapResult = mapper.Map <LapResultSummary>(dbLastPolePositionResult.Entry);
        }
示例#2
0
        private async Task IncludeFastestResult(Race dbNextRace, NextRaceSummary apiNextRace)
        {
            var dbFastestResult = await context.Entries
                                  .Include(e => e.Race)
                                  .Include(e => e.FastestLap)
                                  .Where(e => e.Race.TrackId == dbNextRace.TrackId && e.Race.Date < dbNextRace.Date && e.FastestLap.Frlpos == "1")
                                  .Include(e => e.Driver)
                                  .ThenInclude(d => d.Nationality)
                                  .OrderByDescending(e => e.Race.Date)
                                  .FirstAsync();

            apiNextRace.LastFastestLapResult = mapper.Map <LapResultSummary>(dbFastestResult);
        }
示例#3
0
        private async Task IncludeLastWinnerResult(Race dbNextRace, NextRaceSummary apiNextRace)
        {
            var dbLastWinnerResult = await context.Results
                                     .Include(r => r.Race)
                                     .Where(r => r.Race.TrackId == dbNextRace.TrackId && r.Race.Date < dbNextRace.Date && r.FinishPosition == "1")
                                     .Include(r => r.Entry)
                                     .ThenInclude(e => e.Driver)
                                     .ThenInclude(d => d.Nationality)
                                     .OrderByDescending(r => r.Race.Date)
                                     .FirstAsync();

            apiNextRace.LastWinnerRaceResult = mapper.Map <RaceResultSummary>(dbLastWinnerResult.Entry);
        }