예제 #1
0
파일: Category.cs 프로젝트: jeswin/AgileFx
        public static Category Create(string name, string defaultPage, Category parent, Website website, PermissionSet permSet)
        {
            var slug = SlugHelper.Generate(name);

            return(new Category()
            {
                Name = name,
                UrlAlias = slug,
                Parent = parent,
                DefaultPage = defaultPage,
                Website = website,
                Tenant = website.Tenant,
                IsRoot = (null == parent),
                UniquePath = (parent != null) ? string.Format("{0}{1}/", parent.UniquePath, slug) : "/",
                PermissionSet = permSet
            });
        }
예제 #2
0
파일: Category.cs 프로젝트: jeswin/AgileFx
 public static Category CreateRoot(string name, Website website, PermissionSet permSet)
 {
     return(Create(name, "index", null, website, permSet));
 }
예제 #3
0
파일: Page.cs 프로젝트: jeswin/AgileFx
        public static Page Create(string title, User author, string contentType, string contents, Template template, Category category, string[] tags, bool allowComments, PermissionSet permSet)
        {
            var page = new Page
            {
                Title           = title,
                Author          = author,
                DisplayTemplate = template,
                ContentType     = contentType,
                Category        = category,
                Tags            = string.Format("|{0}|", string.Join("|", tags)),
                AllowComments   = allowComments,
                DateTime        = DateTime.Now,
                Tenant          = category.Tenant,
                UniquePath      = category.UniquePath + SlugHelper.Generate(title) + "/",
                PermissionSet   = permSet
            };

            page.Revisions.Add(new Revision
            {
                Contents = contents,
                DateTime = DateTime.Now,
                Tenant   = category.Tenant
            });
            page.SetHtml();
            return(page);
        }