Linq to linq.js translation with value assignation
<p>I am trying to assign a value with a linq.js expresion. The linq lamba expresion would be like this:</p>

<pre><code>List&lt;SearchSpaceRoom&gt; roomsAvailable = Spaces.Select(s =&gt; 
   { 
       s.Available = s.Rooms.Where(r =&gt; r.RoomTypeRanges.Any(t =&gt; t.Type.ToString() == "Theatre" &amp;&amp; t.Min &lt;= 101 &amp;&amp; t.Max &gt;= 200)).Count(); 
       return s; 
   })
   .ToList();
</code></pre>

<p>But I cannot find the way to do this to work with linq.js. The idea is to have something like this:</p>

<pre><code>var data = eval($('#SpaceJson').val());
var results = $.Enumerable.From(data).ToArray();
var layout = 'Theatre';
var minDelegates = '101';
var maxDelegates = '200';

results = $.Enumerable.From(results)
   .Select('{$.Available = $.Rooms.Where($.RoomTypeRanges.Any($.Type == \'' + layout + '\' &amp;&amp; $.Min &lt;= \'' + parseInt(minDelegates) + '\' &amp;&amp; t.Max &gt;= \'' + parseInt(maxDelegates) + '\')).Count(); return $; }').ToArray();
</code></pre>

<p>Is this possible, can anyone suggest me the best approach to do this?</p>

<p>If you need more information about the expression:
it is to assign the amount of rooms that meets the requirements of Min and Max people for a certain layout (Classroom, Theatre) for each space.
The basic structure is like:</p>

<ol>
<li>One space contains Rooms</li>
<li>One Room contains the different layouts</li>
<li>A layout contains the max an min people</li>
</ol>

<p>I can provide all the data structure if you need but I believe that will confuse more than help.</p>

<p>Thanks!</p>

<p>EDIT: I add the classes here</p>

<pre><code>public class SearchSpaceViewModel
{
    public List&lt;SearchSpaceRoom&gt; Spaces { get; set; }
    public string RoomsJson { get; set; }
}

public class SearchSpaceRoom
{
    public List&lt;RoomItem&gt; Rooms { get; set; }
    public int Available { get; set; }
    .
    .
    .
}

public class RoomItem
{
    public List&lt;RoomTypeRange&gt; RoomTypeRanges { get; set; }
    .
    .
    .

}

public class RoomTypeRange
{
    public string Type { get; set; }
    public int Max { get; set; }
    public int Min { get; set; }
}
</code></pre>