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(IEnumerable dataRows, Func repoID, params Func[] 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() }) }; } } }