public ReportsGrandGridDatesView GroupByDates(string userName, RequestReportsGrid reportsGridData) { var reportsGridDates = new ReportsGrandGridDatesView { ReportsGridView = new List <ReportGridDateView> { new ReportGridDateView { Items = new List <ReportsGridItemsView>() } } }; var timeEntriesForGrouping = GetTimeEntriesForGrouping(userName, reportsGridData); if (!timeEntriesForGrouping.Any()) { return(reportsGridDates); } var timeEntriesGroupByDate = timeEntriesForGrouping .GroupBy(i => i.Date) .ToDictionary(key => key.Key, key => key.Select(value => value)); var result = reportsGridDates.GetViewReportsGrandGridClients(timeEntriesGroupByDate, Mapper); return(result); }
public ReportsGrandGridDatesView ReportsGridGroupByDates(ReportsGridView reportsGridData) { var reportsGridDates = new ReportsGrandGridDatesView { ReportsGridView = new List <ReportGridDateView> { new ReportGridDateView { Items = new List <ReportsGridItemsView>() } } }; var timeEntriesForGrouping = GetTimeEntriesForGrouping(reportsGridData); if (!timeEntriesForGrouping.Any()) { return(reportsGridDates); } var timeEntriesGroupByDate = timeEntriesForGrouping.ToList() .GroupBy(i => i.Date) .OrderBy(x => x.Key.Date) .ToDictionary(key => key.Key, key => key.OrderBy(value => value.Date).AsEnumerable()); var result = reportsGridDates.GetViewReportsGrandGridClients(timeEntriesGroupByDate, Mapper); return(result); }