public override ActionResult Index(RenderModel model)
        {
            var customModel = new NewsPage(CurrentPage);

            customModel.Content = CurrentPage.HasProperty("Content")
                ? new HtmlString(CurrentPage.GetPropertyValue<string>("Content"))
                : new HtmlString(string.Empty);

            customModel.Title = CurrentPage.HasProperty("Title") ? CurrentPage.GetPropertyValue<string>("Title") : CurrentPage.Name;

            //var newsRepository = new NewsRepository();
            var newsRepository = new NewsRepository(this.UmbracoContext.Application.Services.ContentService);
            customModel.News = newsRepository.GetAll();
            return CurrentTemplate(customModel);
        }
Example #2
0
 public NewsController()
 {
     newsRep = new NewsRepository(this.UmbracoContext.Application.Services.ContentService);
 }