Esempio n. 1
0
        public async Task <IActionResult> GetTreeForRoleMenu(int id)
        {
            var menus = await _menuAppService.GetAllAsync();

            var roleMenus = await _menuAppService.GetAllByRoleIdAsync(id);

            var treedata = menus.Select(a => new SimpleTreeViewModel
            {
                Id       = a.Id,
                Name     = a.Name,
                ParentId = a.ParentId,
                Checked  = roleMenus.Any(b => b.Id == a.Id)
            }).ToList();

            return(Json(treedata));
        }