BeiDream.Demo.Service.Roles.Dtos.RoleDtoExtension.ToDto C# (CSharp) Method

ToDto() public static method

转换为角色数据传输对象
public static ToDto ( this entity, System.Guid userId ) : RoleDto
entity this 角色实体
userId System.Guid 用户编号
return RoleDto
        public static RoleDto ToDto(this Role entity, Guid userId)
        {
            RoleDto dto = entity.MapTo<RoleDto>();
            dto.Checked = entity.Users.Select(u => u.Id).Contains(userId);
            return dto;
        }
RoleDtoExtension