예제 #1
0
        private IList <ApiRajaOngkirCityResponseDto> collectAndInsertOrUpdateCities()
        {
            var cities = collectToRajaOngkir <IList <ApiRajaOngkirCityResponseDto> >("city");

            foreach (var cityInputDto in cities)
            {
                if (!_cityService.Exist(cityInputDto.CityId))
                {
                    _cityService.Create(new CreateCityInputDto
                    {
                        IdRajaOngkir         = cityInputDto.CityId,
                        Code                 = cityInputDto.CityName,
                        Name                 = cityInputDto.CityName,
                        PostalCode           = cityInputDto.PostalCode,
                        Type                 = cityInputDto.Type,
                        IdProvinceRajaOngkir = cityInputDto.ProvinceId
                    });
                }
            }

            return(cities);
        }