The following code example explains how content rating can be added to a document using the API.
[C#]
using CMS.TreeEngine; using CMS.CMSHelper;
int nodeId = 241; double rating = 0.5f;
// Get the document TreeProvider tree = new TreeProvider(CMSContext.CurrentUser); CMS.TreeEngine.TreeNode node = tree.SelectSingleNode(nodeId, CMSContext.PreferredCultureCode);
// Add rating // If the 3rd parameter is true, information that the document has been rated is stored in a cookie. It is possible to check if the user rated the document. TreeProvider.AddRating(node, rating, false); |
Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_adding_document_rating.htm