示例#1
0
        public IActionResult CheckAreas(string ids, string parentIds)
        {
            var lstIds         = Utils.SplitCommaInteger(ids);
            var lstParentIds   = Utils.SplitCommaInteger(parentIds);
            var lstParentAreas = new List <int>();

            foreach (var parentId in lstParentIds)
            {
                var parentAreas = _areasService.GetAreasByParentAreaID(parentId, true);
                lstParentAreas.AddRange(parentAreas.Select(x => x.Id).ToList());
            }
            foreach (var id in lstIds)
            {
                if (!lstParentAreas.Contains(id))
                {
                    return(Json(new { success = false, message = "子公司管辖区域不从属于上级公司管辖区域" }));
                }
            }
            return(Json(new { success = true, message = "子公司管辖区域从属于上级公司管辖区域" }));
        }