Ejemplo n.º 1
0
        private void GetRegionsOfProvinceCounty(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            IList <Hidistro.Entities.Store.RegionInfo> allProvinceLists = RegionHelper.GetAllProvinceLists(false);
            string s = JsonConvert.SerializeObject(new
            {
                province = from p in allProvinceLists
                           select new
                {
                    id   = p.RegionId,
                    name = p.RegionName,
                    city = from c in RegionHelper.GetRegionChildList(p.RegionId, false)
                           select new
                    {
                        id     = c.RegionId,
                        name   = c.RegionName,
                        county = from d in RegionHelper.GetRegionChildList(c.RegionId, false)
                                 select new
                        {
                            id   = d.RegionId,
                            name = d.RegionName
                        }
                    }
                }
            });

            context.Response.Write(s);
        }