Example #1
0
        /// <summary>
        /// 根据省市区获取三级区域信息
        /// </summary>
        /// <param name="provinceId"></param>
        /// <param name="cityId"></param>
        /// <param name="districtId"></param>
        /// <returns></returns>
        private async Task <List <int> > GetDistrictIdsByRegionAsync(int provinceId, int cityId, int districtId)
        {
            var regionId  = cityId > 0 ? cityId : (provinceId > 0 ? provinceId : 0);
            var regionIds = districtId > 0 ? new List <int>(1)
            {
                districtId
            } :
            regionId > 0 ? await _regionService.GetDistrictIdsByRegionId(regionId)
                 : (await _regionService.GetAllDistrictsFromCache())?.Select(s => s.DistrictId)?.ToList();

            return(regionIds);
        }