public async Task <IActionResult> GetAreaList() { string parentCode = Request.Query["parentCode"]; string curUserId = Request.Query["curUserId"]; TData <DataTable> obj = await areaBLL.GetAreaList(parentCode, curUserId); return(Json(obj)); }
/// <summary> /// 获取区域行政列表列表(省分和城市) /// </summary> /// <param name="_"></param> /// <returns></returns> private Negotiator List(dynamic _) { try { var recdata = this.GetModule <ReceiveModule>(); bool resValidation = this.DataValidation(recdata.userid, recdata.token); if (!resValidation) { return(this.SendData(ResponseType.Fail, "后台无登录信息")); } else { var data = areaBLL.GetAreaList("0"); Dictionary <string, AreaInfo> dAreaName = new Dictionary <string, AreaInfo>(); foreach (var item in data) { AreaInfo areaInfoitem = new AreaInfo(); areaInfoitem.areaName = item.AreaName; areaInfoitem.children = new Dictionary <string, string>(); var itemData = areaBLL.GetAreaList(item.AreaCode); foreach (var item1 in itemData) { if (!areaInfoitem.children.ContainsKey(item1.AreaCode)) { areaInfoitem.children.Add(item1.AreaCode, item1.AreaName); } } if (!dAreaName.ContainsKey(item.AreaCode)) { dAreaName.Add(item.AreaCode, areaInfoitem); } } return(this.SendData <Dictionary <string, AreaInfo> >(dAreaName, recdata.userid, recdata.token, ResponseType.Success)); } } catch { return(this.SendData(ResponseType.Fail, "异常")); } }
public ActionResult GetAreaListJson(string parentId) { var data = areaBLL.GetAreaList(parentId == null ? "0" : parentId); return(Content(data.ToJson())); }