BeiDream.Demo.Service.Resources.Dtos.ResourceDtoExtension.ToDto C# (CSharp) Method

ToDto() public static method

转换为资源数据传输对象
public static ToDto ( this entity, System.Guid roleId ) : ResourceDto
entity this 资源实体
roleId System.Guid 角色编号
return ResourceDto
        public static ResourceDto ToDto(this Resource entity, Guid roleId)
        {
            ResourceDto dto = entity.MapTo<ResourceDto>();
            dto.Checked = entity.Permissions.Any(p => p.RoleId == roleId);
            return dto;
        }
ResourceDtoExtension