Created
September 28, 2014 12:10
-
-
Save ArveSystad/35e72bae85f3f0d8bfe5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private readonly IContentRepository _contentRepo = ServiceLocator.Current.GetInstance<IContentRepository>(); | |
private readonly ContentAssetHelper _contentAssetHelper = ServiceLocator.Current.GetInstance<ContentAssetHelper>(); | |
Product product = _contentRepo.Get<Product>(new ContentReference(123)); | |
ContentAssetFolder assetFolder = _contentAssetHelper.GetOrCreateAssetFolder(product.ContentLink); | |
Review newReview = _contentRepo.GetDefault<Review>(assetFolder.ContentLink); | |
newReview.Rating = 5; | |
newReview.Text = "This is such a nice product"; | |
newReview.UserDisplayName = "Arve Systad"; | |
newReview.Name = newReview.UserDisplayName + "(" + DateTime.Now.ToShortDateString() + ")"; | |
_contentRepo.Save(newReview, SaveAction.Publish, AccessLevel.NoAccess); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment