/// <summary> /// Determines if the page is published at this moment in time, /// checking the published status, the publish date and checking /// to make sure there is a published version. /// </summary> public static bool IsPublished(this IPublishableEntity entity) { var isPublished = entity.PublishStatus == PublishStatus.Published && entity.HasPublishedVersion && entity.PublishDate <= DateTime.UtcNow; return(isPublished); }
public static bool IsPublished(this IPublishableEntity entity, DateTime now) { return(ModelHelper.IsPublished(now, entity.StartDate, entity.EndDate)); }
/// <summary> /// Gets the current publish state at the current moment in time. /// </summary> public static PublishState GetPublishState(this IPublishableEntity entity) { var publishState = entity.HasPublishedVersion ? entity.PublishStatus : PublishStatus.Unpublished; return(new PublishState(publishState, entity.PublishDate)); }