Esempio n. 1
0
        private Dealer GetDealer(DealerMap dealerMap)
        {
            var city = this.GetOrCreateCity(dealerMap.City);
            var dealer = this.GetOrCreateDealer(dealerMap);

            if (!dealer.Cities.Any(c => c.Name == city.Name))
            {
                dealer.Cities.Add(city);
            }

            return dealer;
        }
Esempio n. 2
0
        private Dealer GetOrCreateDealer(DealerMap dealerMap)
        {
            Dealer dealer;
            this.dealers.TryGetValue(dealerMap.Name, out dealer);

            if (dealer == null)
            {
                dealer = new Dealer()
                {
                    Name = dealerMap.Name
                };

                this.dealers[dealerMap.Name] = dealer;
            }

            return dealer;
        }