public BIPArticleViewModel BIPArticleViewModel(int currentUmbracoPageId) { var _model = new BIPArticleViewModel(); //Aktualna strona, na której się znajdujemy var _currentPage = _umbracoHelper.TypedContent(currentUmbracoPageId); _model.Article = new ArticleBip(_currentPage); return(_model); }
public BIPArticleViewModel BIPArticleViewModel(int currentUmbracoPageId) { var _model = new BIPArticleViewModel(); //Aktualna strona, na której się znajdujemy var _currentPage = _umbracoHelper.TypedContent(currentUmbracoPageId); _model.Article = new ArticleBip(_currentPage); Document document = new Document(_currentPage.Id); DocumentVersionList[] versionList = document.GetVersions(); // versionList = versionList.Where(x => x.Text != "").ToArray(); //var contentService = ApplicationContext.Current.Services.ContentService; //var versionList = contentService.GetVersions(_currentPage.Id).ToArray(); //var dsds = vvv.Where(x=>x.Status == Umbraco.Core.Models.ContentStatus.Published).ToArray(); //var older = umbraco.cms.businesslogic.Content.GetContentFromVersion(versionList[0].Version); _model.ArticleChanges = new List <ArticleBipChanges>(); for (int i = 0; i < versionList.Length; i++) { var versionContent = umbraco.cms.businesslogic.Content.GetContentFromVersion(versionList[i].Version); //var contentVersion = contentService.GetByVersion(versionList[i].Version); if (versionContent.getProperty("descriptionChanges").Value != null) { ArticleBipChanges articleChange = new ArticleBipChanges() { ChangesDate = versionList[i].Date, UserName = versionList[i].User.Name, ChangeDescription = versionContent.getProperty("descriptionChanges").Value.ToString() }; if (i == versionList.Length - 1) { articleChange.ChangeType = "Dodanie artykułu"; } else { articleChange.ChangeType = "Edycja artykułu"; } _model.ArticleChanges.Add(articleChange); } } return(_model); }