/// <summary>
        /// Maps an <see cref="IEnumerable{AuditDisplay}"/> to a <see cref="SalesHistoryDisplay"/>
        /// </summary>
        /// <param name="auditLogs">
        /// The audit logs.
        /// </param>
        /// <returns>
        /// The <see cref="SalesHistoryDisplay"/>.
        /// </returns>
        public static SalesHistoryDisplay ToSalesHistoryDisplay(this IEnumerable<AuditLogDisplay> auditLogs)
        {
            var logsArray = auditLogs.ToArray().OrderBy(x => x.RecordDate);
            var history = new SalesHistoryDisplay();
            if (!logsArray.Any()) return history;

            var dates = logsArray.Select(x => x.RecordDate.GetDayDate()).Distinct();

            history.DailyLogs = dates.Select(logsArray.BuildDailyAuditLogDisplay).OrderByDescending(x => x.Day);

            return history;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Maps an <see cref="IEnumerable{AuditDisplay}"/> to a <see cref="SalesHistoryDisplay"/>
        /// </summary>
        /// <param name="auditLogs">
        /// The audit logs.
        /// </param>
        /// <returns>
        /// The <see cref="SalesHistoryDisplay"/>.
        /// </returns>
        public static SalesHistoryDisplay ToSalesHistoryDisplay(this IEnumerable <AuditLogDisplay> auditLogs)
        {
            var logsArray = auditLogs.ToArray().OrderBy(x => x.RecordDate);
            var history   = new SalesHistoryDisplay();

            if (!logsArray.Any())
            {
                return(history);
            }

            var dates = logsArray.Select(x => x.RecordDate.GetDayDate()).Distinct();

            history.DailyLogs = dates.Select(logsArray.BuildDailyAuditLogDisplay).OrderByDescending(x => x.Day);

            return(history);
        }