Applied patch from uComponents for uQuery - GetContentIdByPropertyId
This commit is contained in:
@@ -1727,6 +1727,9 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\xslt\eXslt\ExsltSets.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\xslt\eXslt\ExsltStrings.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery-Content.cs">
|
||||
<DependentUpon>uQuery.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\uQuery\uQuery-DataTypes.cs">
|
||||
<DependentUpon>uQuery.cs</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using umbraco.cms.businesslogic;
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
public static partial class uQuery
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <c>Content</c> Id by property Id.
|
||||
/// </summary>
|
||||
/// <param name="propertyId">The property id.</param>
|
||||
/// <returns>Returns the <c>Content</c> Id.</returns>
|
||||
public static int GetContentIdByPropertyId(int propertyId)
|
||||
{
|
||||
if (propertyId > 0)
|
||||
{
|
||||
var sql = "SELECT contentNodeId FROM cmsPropertyData WHERE id = @propertyId";
|
||||
return uQuery.SqlHelper.ExecuteScalar<int>(sql, uQuery.SqlHelper.CreateParameter("@propertyId", propertyId));
|
||||
}
|
||||
|
||||
return uQuery.RootNodeId;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user