public ActionResult GetRegion(int parentId = 0) { var list = regionBll.GetRegionList(parentId).ToDictionary(k => { return(k.Reg_ID); }, v => { return(v.Reg_Name); }); var result = OptionFactory.CreateOptions(list); return(Select2(result, JsonRequestBehavior.AllowGet)); }
public void GetRegionTest() { List <int> ids = new List <int>() { 13, 14 }; int id = 0; var list = bll.GetRegionByIds(ids, RegionTypeEnum.省); BaseAssertList(list); ids = new List <int>() { 1301, 1302 }; list = bll.GetRegionByIds(ids, RegionTypeEnum.市); BaseAssertList(list); ids = new List <int>() { 140825, 140826 }; list = bll.GetRegionByIds(ids, RegionTypeEnum.区); BaseAssertList(list); var regs = bll.GetRegionList(id); BaseAssertList(regs); id = 13; regs = bll.GetRegionList(id); BaseAssertList(regs); id = 1301; regs = bll.GetRegionList(id); BaseAssertList(regs); }