コード例 #1
0
        public RolePermissionViewModel(string roleid, IEnumerable <Permission> permissions, IEnumerable <RolePermission> rolepermissions)
            : this()
        {
            this.SelectedRoleId = roleid;
            foreach (var permission in permissions)
            {
                // An EditorViewModel will be used by Editor Template:
                var spevm = new SelectPermissionEditorViewModel(permission);
                this.Permissions.Add(spevm);
            }

            foreach (var rolepermission in rolepermissions)
            {
                var checkPermission =
                    this.Permissions.Find(r => r.PermissionId == rolepermission.PermissionId);
                checkPermission.Selected = true;
            }
        }
コード例 #2
0
        public RolePermissionViewModel(string roleid, IEnumerable<Permission> permissions, IEnumerable<RolePermission> rolepermissions)
            : this()
        {
            this.SelectedRoleId = roleid;
            foreach (var permission in permissions)
            {
                // An EditorViewModel will be used by Editor Template:
                var spevm = new SelectPermissionEditorViewModel(permission);
                this.Permissions.Add(spevm);
            }

            foreach (var rolepermission in rolepermissions)
            {
                var checkPermission =
                    this.Permissions.Find(r => r.PermissionId == rolepermission.PermissionId);
                checkPermission.Selected = true;
            }
        }