Exemplo n.º 1
0
        /// <summary>
        /// Determines whether the revision has a pending publish to be made
        /// </summary>
        /// <param name="rev">The rev.</param>
        /// <returns>
        ///   <c>true</c> if [is publish pending] [the specified rev]; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsPublishPending(this EntitySnapshot <TypedEntity> rev)
        {
            if (rev == null)
            {
                return(false);
            }

            var lastPublished = rev.GetLatestDate(FixedStatusTypes.Published);
            var lastSaved     = rev.GetLatestDate(FixedStatusTypes.Draft);

            return(lastSaved > lastPublished);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the published date if it is published, otherwise returns null
        /// </summary>
        /// <param name="rev"></param>
        /// <returns></returns>
        public static DateTimeOffset?PublishedDate(this EntitySnapshot <TypedEntity> rev)
        {
            if (rev == null)
            {
                return(null);
            }

            var lastPublished   = rev.GetLatestDate(FixedStatusTypes.Published);
            var lastUnpublished = rev.GetLatestDate(FixedStatusTypes.Unpublished);

            return(lastPublished > lastUnpublished
                       ? (DateTimeOffset?)lastPublished
                       : null);
        }