antonydoyle
11/18/2013 - 2:46 PM

GetNodeByContentId

GetNodeByContentId

@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
@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;
        }
     }
}