コード例 #1
0
        public static Role ToRoleDomainModel(this RoleApiModel role)
        {
            var roleDomainModel = new Role
            {
                Id                  = role.Id ?? Guid.Empty,
                Grain               = role.Grain,
                SecurableItem       = role.SecurableItem,
                Name                = role.Name,
                ParentRole          = role.ParentRole,
                ChildRoles          = role.ChildRoles?.ToList() ?? new List <Guid>(),
                Permissions         = role.Permissions?.Select(p => p.ToPermissionDomainModel()).ToList() ?? new List <Permission>(),
                DeniedPermissions   = role.DeniedPermissions?.Select(p => p.ToPermissionDomainModel()).ToList() ?? new List <Permission>(),
                CreatedDateTimeUtc  = role.CreatedDateTimeUtc,
                ModifiedDateTimeUtc = role.ModifiedDateTimeUtc,
                CreatedBy           = role.CreatedBy,
                ModifiedBy          = role.ModifiedBy
            };

            return(roleDomainModel);
        }
コード例 #2
0
        public static RoleApiModel ToRoleApiModel(this Role role)
        {
            var roleApiModel = new RoleApiModel
            {
                Id                  = role.Id,
                Grain               = role.Grain,
                SecurableItem       = role.SecurableItem,
                Name                = role.Name,
                ParentRole          = role.ParentRole,
                ChildRoles          = role.ChildRoles.ToList(),
                Permissions         = role.Permissions?.Select(p => p.ToPermissionApiModel()),
                DeniedPermissions   = role.DeniedPermissions?.Select(p => p.ToPermissionApiModel()),
                CreatedDateTimeUtc  = role.CreatedDateTimeUtc,
                ModifiedDateTimeUtc = role.ModifiedDateTimeUtc,
                CreatedBy           = role.CreatedBy,
                ModifiedBy          = role.ModifiedBy
            };

            return(roleApiModel);
        }