Skip to content

Instantly share code, notes, and snippets.

@ps-team
Created November 18, 2013 14:46
Show Gist options
  • Save ps-team/7528970 to your computer and use it in GitHub Desktop.
Save ps-team/7528970 to your computer and use it in GitHub Desktop.
GetNodeByContentId
@functions
{
public Node GetNodeByContentId(int contentId)
{
var myQuery = Query.Where("Property_C_ID").IsEqualTo(contentId.ToString());
var nodes = new NodeFinder().Find(myQuery);
if (nodes.Count > 0) {
return nodes[0];
} else {
return null;
}
}
}
@Functions
Function GetNodeByContentId(contentId As Integer) As Node
Dim myQuery = Query.Where("Property_C_ID").IsEqualTo(contentId)
Dim nodes = New NodeFinder().Find(myQuery, 1, selectCount:=1)
If nodes.Count > 0 Then
Return nodes(0)
Else
Return Nothing
End If
End Function
End Functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment