LINQ where clause with an if statement
<p>I have electrical panel LINQ statement that I want to filter by voltage type.
The condition is if a circuit is 230V it should filter all 400V panels, if its 120V it should filter all 208V panels, all other circuit voltages are equal to the panel voltages. ie 400V = 400V.</p>

<p>I need a conditional statement for my voltage where clause. Here is my first attempt but it doesn't seem to work for me.</p>

<pre><code>var panels = from p in context.tblPanels
             join x in context.SI_GridCoordinates 
             on new {fac = p.Facility, X = p.X} 
                equals new { fac = x.FAB, X = x.GRID}
             join y in context.SI_GridCoordinates 
             on new { fac = p.Facility, Y = p.Y } 
                equals new { fac = y.FAB, Y = y.GRID }
             where p.Train == item.train &amp;&amp;  
             if (item.voltage == 230) { p.Voltage == 400} else if (item.voltage == 120) { p.Voltage == 208 } else { p.Voltage ==item.voltage}
</code></pre>

<p>This obviously doesn't work!</p>