public static string GetViewableRolesAsListOfStrings(this CustomPage customPage)
        {
            var customPageRoles = HttpRequestStorage.DatabaseEntities.CustomPageRoles.Where(x => x.CustomPageID == customPage.CustomPageID).ToList();

            return(customPage.CustomPageRoles.Any()
                ? string.Join(", ", customPage.CustomPageRoles.OrderBy(x => x.Role?.SortOrder).Select(x => x.Role == null ? "Anonymous (Public)" : x.Role.GetRoleDisplayName()).ToList())
                : "Disabled");
        }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public CustomPageImage(CustomPage customPage, FileResource fileResource) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.CustomPageImageID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.CustomPageID      = customPage.CustomPageID;
     this.CustomPage        = customPage;
     customPage.CustomPageImages.Add(this);
     this.FileResourceID = fileResource.FileResourceID;
     this.FileResource   = fileResource;
     fileResource.CustomPageImages.Add(this);
 }
 public static bool IsDisabled(this CustomPage customPage)
 {
     return(!customPage.CustomPageRoles.Any());
 }
 public static string GetDeleteUrl(this CustomPage customPage) =>
 SitkaRoute <CustomPageController> .BuildUrlFromExpression(c => c.DeleteCustomPage(customPage.CustomPageID));
 public static string GetAboutPageUrl(this CustomPage customPage) =>
 SitkaRoute <CustomPageController> .BuildUrlFromExpression(t => t.About(customPage.CustomPageVanityUrl));
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static CustomPageImage CreateNewBlank(CustomPage customPage, FileResource fileResource)
 {
     return(new CustomPageImage(customPage, fileResource));
 }
示例#7
0
 public static void DeleteCustomPage(this IQueryable <CustomPage> customPages, CustomPage customPageToDelete)
 {
     DeleteCustomPage(customPages, new List <CustomPage> {
         customPageToDelete
     });
 }