Kentico CMS 6.0 Developer's Guide

Modifying document rating

Modifying document rating

Previous topic Next topic Mail us feedback on this topic!  

Modifying document rating

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

The following code example shows how rating of a document can be modified using the API.

 

[C#]

 

using CMS.TreeEngine;

using CMS.CMSHelper;

 

int nodeId = 241;

double rating = 1.0f;

int numOfRatings = 2;

 

// Get the document

TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);

CMS.TreeEngine.TreeNode node = tree.SelectSingleNode(nodeId, CMSContext.PreferredCultureCode);

 

// Modify its rating

TreeProvider.SetRating(node, rating, numOfRatings);