このデータセットはここにあります。イベントには、次EventGroups
のタイプのプロパティがありますList<Groups>
List<Events> e;
List<Groups> g;
// Get the data from the database using dapper
using( var con = DataAccessMaster.GetOpenConnection( ) ) {
using( var multi = con.QueryMultiple( sprocname, new { StartDate = fromDate, EndDate = toDate }, commandType:CommandType.StoredProcedure ) ) {
e = multi.Read<Events>( ).ToList( );
g = multi.Read<Groups>().ToList();
}
}
// Only put the groups that belong to one another within the related event so that when we goto bind it will be painless
foreach ( var ev in e ) {
ev.EventGroups = new List<Groups>();
foreach ( Groups group in g.Where( Groups => ( ev.EventID == Groups.EventID ) ) ) {
ev.EventGroups.Add( group );
}
}
return e;
最後のブロックは、それよりもきれいに書き直すことができたように感じます。これをきれいにするために何ができますか?