Adding
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LCU.API.Collections.RepoApi.Models.Reporting;
|
||||
using LCU.Shared.Collections.RepoApiLib.Models.Reporting.Responses;
|
||||
|
||||
namespace LCU.Shared.Collections.RepoApiLib.Formatting
|
||||
{
|
||||
public static class DataTableFormatting
|
||||
{
|
||||
|
||||
public static DataTable CreateDataTable<T>(IEnumerable<T> dataRows, Func<T, int> repoID, params Func<T, ReportHeaderCellMap>[] columns)
|
||||
{
|
||||
return new DataTable()
|
||||
{
|
||||
Headers = columns.Select(column => column(default(T)).Header).ToArray(),
|
||||
Rows = dataRows.Select(entry => new RepoAccountReferenceRow()
|
||||
{
|
||||
RepoId = repoID(entry),
|
||||
Cells = columns.Select(column => column(entry).Cell).ToArray()
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user