Ejemplo n.º 1
0
        public void OnGet(long id)
        {
            command = _roleApplication.GetDetail(id);
            var permissions = new List <PermissionDto>();

            foreach (var exposer in _exposers)
            {
                var exposedPermission = exposer.Expose();
                foreach (var(key, value) in exposedPermission)
                {
                    permissions.AddRange(value);
                    var group = new SelectListGroup()
                    {
                        Name = key
                    };
                    foreach (var permission in value)
                    {
                        var item = new SelectListItem(permission.Name, permission.Code.ToString())
                        {
                            Group = group
                        };
                        if (command.MappedPermissions.Any(x => x.Code == permission.Code))
                        {
                            item.Selected = true;
                        }
                        Permissions.Add(item);
                    }
                }
            }
        }