Exemplo n.º 1
0
        private static void ProcessMatchInformations(IList <MatchInformation> matchInformations, HashSet <Fighter> fighters, HashSet <Match> matches)
        {
            foreach (var matchInfo in matchInformations)
            {
                var fighter1 = GetOrCreateFighter(matchInfo.Fighter1, fighters);
                var fighter2 = GetOrCreateFighter(matchInfo.Fighter2, fighters);

                if (fighter1 == null || fighter2 == null)
                {
                    continue;
                }

                var result = ResultHelper.FromString(matchInfo.Result);
                var year   = Int32.Parse(matchInfo.Year);

                var match = new Match(fighter1, fighter2, result, year);

                if (matches.Any(m => m.Equals(match)))
                {
                    continue;
                }

                matches.Add(match);
            }
        }