Ejemplo n.º 1
0
        public async Task <IResultModel> BindMenus(RoleMenusBindModel model)
        {
            _rolePermissionRepository.BeginTrans();
            var result = await _roleMenuRepository.DeleteByRole(model.RoleId);

            if (result >= 0)
            {
                if (model.Menus != null && model.Menus.Any())
                {
                    var list = model.Menus.Select(m => new RoleMenuEntity
                    {
                        RoleId = model.RoleId,
                        MenuId = m
                    }).ToList();

                    await _roleMenuRepository.InsertAsync(list);
                }

                _rolePermissionRepository.Commit();
                //todo 这里是做什么的需要搞清楚
                //await ClearAccountPermissionCache(model.RoleId);
                return(ResultModel.Success());
            }
            return(ResultModel.Failed());
        }
Ejemplo n.º 2
0
 public Task <IResultModel> BindMenus(RoleMenusBindModel model)
 {
     return(_service.BindMenus(model));
 }