Beispiel #1
0
        /// <summary>
        /// If you need to have a custom Cache Dependency, you will need to use custom Caching
        /// </summary>
        /// <returns>All the Example Pages</returns>
        public IEnumerable <ExamplePageTypeModel> GetExamplePages_CustomCacheDependency()
        {
            // Get the Pages
            return(mCacheHelper.Cache <IEnumerable <ExamplePageTypeModel> >(() =>
            {
                var Pages = ExamplePageTypeProvider.GetExamplePageTypes()
                            .LatestVersion(mLatestVersionEnabled)
                            .Published(!mLatestVersionEnabled)
                            .OnSite(SiteContext.CurrentSiteName)
                            .Culture(mCultureName)
                            .CombineWithDefaultCulture()
                            .OrderBy("NodeOrder")
                            .ToList();

                // Convert to Model
                return Pages.Select(x =>
                {
                    return new ExamplePageTypeModel()
                    {
                        Name = x.Name,
                        ID = x.NodeID
                    };
                }).ToList();
            }, "KenticoExamplePageTypeRepository.GetExamplePages", GetExamplePagesCacheDependency(), mCacheHelper.CacheDuration()));
        }
Beispiel #2
0
 public ExamplePageType GetExamplePage_TreeNode(int ID)
 {
     return(ExamplePageTypeProvider.GetExamplePageType(ID, mCultureName, SiteContext.CurrentSiteName)
            .LatestVersion(mLatestVersionEnabled)
            .Published(!mLatestVersionEnabled)
            .CombineWithDefaultCulture()
            .FirstOrDefault());
 }
Beispiel #3
0
 /// <summary>
 /// No Cache needed as the Interceptor will detect the return type is IEnumerable of TreeNode and add the "nodes|sitename|classname|all" dependency
 /// </summary>
 /// <returns>Get All Example Pages</returns>
 public IEnumerable <ExamplePageType> GetExamplePages_TreeNodes()
 {
     return(ExamplePageTypeProvider.GetExamplePageTypes()
            .LatestVersion(mLatestVersionEnabled)
            .Published(!mLatestVersionEnabled)
            .OnSite(SiteContext.CurrentSiteName)
            .Culture(mCultureName)
            .CombineWithDefaultCulture()
            .OrderBy("NodeOrder")
            .ToList());
 }
Beispiel #4
0
        public ExamplePageTypeModel GetExamplePage(Guid guid)
        {
            // Get the Page
            var Page = ExamplePageTypeProvider.GetExamplePageType(guid, mCultureName, SiteContext.CurrentSiteName)
                       .LatestVersion(mLatestVersionEnabled)
                       .Published(!mLatestVersionEnabled)
                       .CombineWithDefaultCulture()
                       .FirstOrDefault();

            // Convert to Model
            return(new ExamplePageTypeModel()
            {
                Name = Page.Name,
                ID = Page.NodeID
            });
        }
Beispiel #5
0
        public IEnumerable <ExamplePageTypeModel> GetExamplePages()
        {
            var Pages = ExamplePageTypeProvider.GetExamplePageTypes()
                        .LatestVersion(mLatestVersionEnabled)
                        .Published(!mLatestVersionEnabled)
                        .OnSite(SiteContext.CurrentSiteName)
                        .Culture(mCultureName)
                        .CombineWithDefaultCulture()
                        .ToList();

            // Convert to Model
            return(Pages.Select(x =>
            {
                return new ExamplePageTypeModel()
                {
                    Name = x.Name,
                    ID = x.NodeID
                };
            }).ToList());
        }