Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You're making this more complex than you need to I think. If you start with a list of showtimes, then it's a simple matter of ordering to enumerate.</p> <pre><code>List&lt;Show&gt; startTimes = GetTimesFromDB(); var moviesGrouped = startTimes.GroupBy(x =&gt; x.Name); foreach(var group in moviesGrouped) { // print times for each movie } </code></pre> <p>To use a concrete example, lets use this sample:</p> <pre><code>List&lt;Sample&gt; sample = new List&lt;Sample&gt; { new Sample { Id = 1, Time = DateTime.Now }, new Sample { Id = 1, Time = DateTime.Now.AddDays(1) }, new Sample { Id = 2, Time = DateTime.Now.AddDays(2) }, new Sample { Id = 2, Time = DateTime.Now.AddDays(3) }, new Sample { Id = 3, Time = DateTime.Now.AddDays(4) }, }; foreach (var group in sample.GroupBy(x =&gt; x.Id)) { foreach (var element in group) { Console.WriteLine(element.Id); Console.WriteLine(element.Time); } } </code></pre> <p>You simply group by your token (in this case movie name), and then enumerate the grouping (which will contain your movie times). </p> <p>However, you could greatly simplify this by changing your object model.</p> <pre><code>public class Movie { public int MovieId { get; set; } public string Name { get; set; } public List&lt;Showing&gt; Showings { get; set; } } public class Showing { public DateTime StartTime { get; set; } public List&lt;Seat&gt; UnsoldSeats { get; set; } // Etc } </code></pre> <p>Then when you have a <code>List&lt;Movie&gt;</code>, it's already set up to do that display, and it naturally makes more sense than a simple showing class. </p> <pre><code>foreach(var movie in movies) { foreach(var showing in movie.Showings) // DoStuff } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload