コード例 #1
0
        /// <summary>
        /// 获取所有年检省份
        /// </summary>
        /// <returns></returns>
        public List <InspectionRegion> GetAllInspectionRegion()
        {
            var result = null as List <InspectionRegion>;

            try
            {
                using (var client = new RegionClient())
                {
                    var regionresponse = client.GetAllProvince();
                    if (regionresponse != null && regionresponse.Result != null)
                    {
                        result = regionresponse.Result.Select(p => new InspectionRegion()
                        {
                            RegionId   = p.RegionId,
                            RegionName = p.RegionName
                        }).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("GetAllInspectionRegion", ex);
            }
            return(result ?? new List <InspectionRegion>());
        }
コード例 #2
0
 public ActionResult GetAllProvince()
 {
     using (var client = new RegionClient())
     {
         var allProvinceResult = client.GetAllProvince();
         allProvinceResult.ThrowIfException(true);
         return(Json(allProvinceResult.Result, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #3
0
        /// <summary>
        /// 获取所有省
        /// </summary>
        /// <param name="regionId"></param>
        /// <returns></returns>
        public static IEnumerable <SimpleRegion> GetAllProvince()
        {
            IEnumerable <SimpleRegion> result = null;

            try
            {
                using (var client = new RegionClient())
                {
                    var getResult = client.GetAllProvince();
                    getResult.ThrowIfException(true);
                    result = getResult.Result;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(result);
        }