Пример #1
0
        private void CreateBlogBPage()
        {
            var result = SampleUtilities.CreatePage(new Guid(BlogBPageId), "Blog B");

            if (result)
            {
                SampleUtilities.SetTemplateToPage(new Guid(BlogBPageId), new Guid(SamplesTemplateId));

                var templateKey = SampleUtilities.GetControlTemplateKey(typeof(MasterPostsView), "Titles, dates and summaries");
                SampleUtilities.RegisterBlogPostsFrontendView("BlogPostsFrontend", templateKey, typeof(MasterPostsView), "BlogPostsFrontendBlogList");

                var blogsControl = new BlogPostView();
                blogsControl.MasterViewName = "BlogPostsFrontendBlogList";
                var parent = new List <Guid>()
                {
                    new Guid(SampleBlogBId)
                };
                ((IContentViewMasterDefinition)blogsControl.ControlDefinition.Views[blogsControl.MasterViewName]).ItemsParentsIds = parent;

                SampleUtilities.AddControlToPage(new Guid(BlogBPageId), blogsControl, "Content", "Blog B View");

                // save default page for blog posts
                App.WorkWith().Blog(new Guid(SampleBlogBId)).Do(b => b.DefaultPageId = new Guid(BlogBPageId)).SaveChanges();
            }
        }