Hi guys
We got an event calendar where we would like to 'nest' the grouping of items in the current order:
- Weekday
- Venue
- Artist
- Artist
- Artist
- Venue
- Artist
- Artist
- Venue
We got the following code (current.jpg) made with LINQ but we are struggeling to make the above nesting (desired.jpg)
Any ideas on how we can 'nest' this LINQ?
Below is the code we got so far:
@using System; @using System.Collections.Generic; @using System.Linq; @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> @{ var items = GetLoop("ItemPublisher:Items.List") .SelectMany(item => item.GetLoop("ItemPublisher:Item.WhenAndWhere") .Select(artist => new { date = artist.GetDate("ItemPublisher:Item.WhenAndWhere.Date"), title = item.GetString("ItemPublisher:Item.Title"), image = item.GetString("ItemPublisher:Item.Image"), focal = item.GetString("ItemPublisher:Item.Image.FocalPointParameters"), link = item.GetString("ItemPublisher:Item.Url"), venue = artist.GetString("ItemPublisher:Item.WhenAndWhere.Where") })) .OrderBy(item => item.date) .GroupBy(item => item.date.ToString("dddd")) .Select(group => new { Day = group.Key, Events = group }); } <div class="grid"> @foreach (var item in items) { <div class="grid__col-md-12"> <h3 class="u-no-margin">@item.Day</h3> </div> <div class="grid__col-md-12"> <div class="grid"> @foreach(var e in item.Events){ <div class="grid__col-md-12"> <div class="u-flex"> <div class="u-flex grid--align-start grid--direction-column grid--justify-center"> <h5 class="u-no-margin">@e.title @e.venue @e.date.ToString("'kl' HH:mm")</h5> </div> </div> </div> } </div> </div> } </div>