public async Task UpdateDistanceAsync(Distance distance) { await context.LoadAsync(distance, d => d.Races); foreach (var race in distance.Races) { OnUpdatingDistance(distance, race); } await context.SaveChangesAsync(); }
public async Task UpdateCompetitionAsync(Competition competition) { await EnsureValidSerieAsync(competition); if (competition.VenueCode != null) { await context.LoadAsync(competition, c => c.Distances); foreach (var distance in competition.Distances.Where(d => d.VenueCode == null)) { distance.VenueCode = competition.VenueCode; distance.VenueDiscipline = competition.Discipline; } } await context.SaveChangesAsync(); recorder.RecordEvent(new CompetitionChangedEvent(competition)); }
public async Task LoadPassingsAsync(Race race, string instanceName = null) { instanceName = instanceName ?? race.PresentedInstanceName; await context.LoadAsync(race, r => r.Passings, p => p.InstanceName == instanceName); }