PdfRpt.Calendar.DaysInfoToCalendarData.MapToCalendarDataList C# (CSharp) Method

MapToCalendarDataList() public static method

Maps list of the DayInfo's to the list of CalendarData's.
public static MapToCalendarDataList ( this dataRows ) : IList
dataRows this List of the DayInfo's
return IList
        public static IList<CalendarData> MapToCalendarDataList(this IList<DayInfo> dataRows)
        {
            if (dataRows == null || !dataRows.Any())
                return null;

            var rows = dataRows.OrderBy(x => x.Year).ThenBy(x => x.Month);
            return rows.GroupBy(x =>
                new
                {
                    Year = x.Year,
                    Month = x.Month
                })
                .Select(x => new CalendarData
                {
                    Month = x.Key.Month,
                    Year = x.Key.Year,
                    MonthDaysInfo = x.ToList()
                })
                .ToList();
        }
DaysInfoToCalendarData