Exemplo n.º 1
0
        public async Task <IActionResult> GetList()
        {
            var codeList = await _codeService.GetListAsync(m => m.ParentGuid == "a88fa4d3-3658-4449-8f4a-7f438964d716", m => m.Sort, DbOrderEnum.Asc);

            var list = await _sysMenuService.GetListAsync(m => m.Status, m => m.Sort, DbOrderEnum.Asc);

            foreach (var item in list.data)
            {
                if (string.IsNullOrEmpty(item.BtnFunJson))
                {
                    continue;
                }
                var btns = JsonConvert.DeserializeObject <List <string> >(item.BtnFunJson);
                if (btns.Count > 0)
                {
                    foreach (var row in btns)
                    {
                        var code = codeList.data.FirstOrDefault(m => m.Guid == row);
                        item.btnFun.Add(new SysBtnFun()
                        {
                            Guid = code.Guid,
                            Name = code.Name
                        });
                    }
                }
            }
            return(Ok(list));
        }