Skip to content

Instantly share code, notes, and snippets.

@thePunderWoman
Created November 6, 2012 22:02
Show Gist options
  • Save thePunderWoman/4027895 to your computer and use it in GitHub Desktop.
Save thePunderWoman/4027895 to your computer and use it in GitHub Desktop.
Vehicle Display
<ul class="vehicles" id="vehicleData">
@foreach(CurtAdmin.BaseVehicle bv in vehicles) {
<li>@bv.YearID @bv.vcdb_Make.MakeName @bv.vcdb_Model.ModelName
<ul class="submodels">
@foreach(CurtAdmin.Submodel s in bv.vcdb_Vehicles.Where(x => x.SubModelID != null).Select(x => x.Submodel).Distinct().OrderBy(x => x.SubmodelName)) {
<li>@s.SubmodelName
@if(bv.vcdb_Vehicles.Where(x => x.SubModelID.Equals(s.ID)).Any(x => x.ConfigID != null)) {
<a href="#" class="showConfig">Show Configs</a>
<table class="configs">
<thead>
<tr>
@foreach (CurtAdmin.ConfigAttributeType config in bv.vcdb_Vehicles.Where(x => x.SubModelID.Equals(s.ID)).SelectMany(x => x.VehicleConfig.VehicleConfigAttributes).Select(x => x.ConfigAttribute.ConfigAttributeType).Distinct().OrderBy(x => x.sort)) {
<th>@config.name</th>
}
</tr>
</thead>
<tbody>
@foreach(CurtAdmin.VehicleConfig vconfig in bv.vcdb_Vehicles.Where(x => x.SubModelID.Equals(s.ID)).Select(x => x.VehicleConfig)) {
<tr>
@foreach (CurtAdmin.ConfigAttributeType config in bv.vcdb_Vehicles.Where(x => x.SubModelID.Equals(s.ID)).SelectMany(x => x.VehicleConfig.VehicleConfigAttributes).Select(x => x.ConfigAttribute.ConfigAttributeType).Distinct().OrderBy(x => x.sort)) {
configval = vconfig.VehicleConfigAttributes.Where(x => x.ConfigAttribute.ConfigAttributeTypeID.Equals(config.ID)).Select(x => x.ConfigAttribute.value).ToList<string>();
<td>@((configval.Count == 0) ? "" : configval.Aggregate((i, j) => i + " " + j))</td>
}
</tr>
}
</tbody>
</table>
}
</li>
}
</ul>
</li>
}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment