title: C# Linq use Where with IsNull() Operator '&&' cannot be applied to operands of type 'bool' and 'int?'
body: <p>I am in the process of converting an old classic asp site to .NET MVC 5, Entity Framework 6.</p>
  
  <p>I am stuck on a linq query that I cannot figure out.
  Here is my original SQL query:</p>
  
  <pre><code>@"SELECT DISTINCT AC.id, AC.name, ISNULL(AC.[order], 999) 
          FROM tbl12AuditCategories AC 
          INNER JOIN tbl12AuditQuestions AQ ON AC.id = AQ.new_categoryId 
          WHERE AQ.include = 1 AND AC.include = 1 AND ISNULL(AC.AuditQuestionGroupId, '0') = ? 
          ORDER BY ISNULL(AC.[order], 999), AC.name";
  </code></pre>
  
  <p>I would pass in a value to the ISNULL(AC.AuditQuestionGroupId, '0') = ?. Now with Linq I can just pass the value in easily.</p>
  
  <pre><code> PracticeConductViewModel pcvm = new PracticeConductViewModel();
              pcvm.Categories = (from x in _repository.GetAll&lt;ReviewCategory&gt;()
                                 join y in _repository.GetAll&lt;ReviewQuestion&gt;()
                                  on x.id equals y.CategoryId
                                 orderby x.order == null ? 999 : x.order, x.name
                                where x.include == true &amp;&amp; y.include == true &amp;&amp; (x.AuditQuestionGroupId != null ? this.LoggedInEntity.AuditQuestionGroupId : 0)
                                select x).ToList();
  </code></pre>
  
  <p>My problem is this line:
  where x.include == true &amp;&amp; y.include == true &amp;&amp; (x.AuditQuestionGroupId != null ? this.LoggedInEntity.AuditQuestionGroupId : 0)</p>
  
  <p>I get the error:</p>
  
  <pre><code>Operator '&amp;&amp;' cannot be applied to operands of type 'bool' and 'int?'
  </code></pre>
  
  <p>I understand what it is telling me, but I can't figure out how to correctly get the ISNULL(..) function converted from the SQL.</p>