void AddToEventAggregator(RecognizedSportEvent recSportEvent1, RecognizedSportEvent recSportEvent2) { var id = EventNameHelper.GetEventId(recSportEvent1.SportEvent); var aggregator = _EventAggregators.FirstOrDefault(u => u.Id == id); if (aggregator != null) { aggregator.RecognizedSportEvents.RemoveAll( u => u.SportEvent.Bookmaker == recSportEvent1.SportEvent.Bookmaker || u.SportEvent.Bookmaker == recSportEvent2.SportEvent.Bookmaker); aggregator.RecognizedSportEvents.Add(recSportEvent1); aggregator.RecognizedSportEvents.Add(recSportEvent2); return; } var newAggregator = new EventAggregator(id) { Sport = Sport.Soccer, RecognizedSportEvents = new List <RecognizedSportEvent> { recSportEvent1, recSportEvent2 }, Team1 = recSportEvent1.Team1.Title, Team2 = recSportEvent1.Team2.Title, }; _EventAggregators.Add(newAggregator); }
private void AddEvent(RecognizedSportEvent recSportEvent) { var list = _bookmakerEvents[recSportEvent.SportEvent.Bookmaker]; var oldVersion = list.FirstOrDefault(u => u.SportEvent.Id == recSportEvent.SportEvent.Id); if (oldVersion != null) { list.Remove(oldVersion); } list.Add(recSportEvent); }