Convert SQL query to LINQ with EXISTS and Dates
<p>I am new to using LINQ and I'm trying to convert a SQL query to linq within MVC 5.</p>

<p>My query is a follows:</p>

<pre><code>SELECT COUNT(Core.CoreName) FROM Core WHERE Core.DCID = @0 
AND EXISTS (SELECT * FROM AspNetUsers,Response 
WHERE Core.CoreID = AspNetUsers.CoreID 
AND Response.UserID = AspNetUsers.Id 
AND Core.DCID = @1 
AND YEAR( Response.CreatedOn ) = YEAR( getDate() ) 
AND MONTH( Response.CreatedOn ) = MONTH( getDate() ));
</code></pre>

<p>Using Linqer I was able to get this but it doesnt seem to work due to the dates:</p>

<pre><code>    from Core in
(from Core in db.Core
where
  Core.DCID == @0 &amp;&amp;

    (from Response in db.Response
    where
      Core.CoreID == Response.AspNetUsers.CoreID &amp;&amp;
      Core.DCID == @1 &amp;&amp;
      Response.CreatedOn.Value.Year == Convert.ToDateTime(DateTime.Now).Year &amp;&amp;
      Response.CreatedOn.Value.Month == Convert.ToDateTime(DateTime.Now).Month
    select new {
      Response,
      Response.AspNetUsers
    }).Single() != null
    select new {
      Core.CoreName,
      Dummy = "x"
    })

        group Core by new { Core.Dummy } into g
        select new {
          Column1 = g.Count(p =&gt; p.CoreName != null)
        }
</code></pre>

<p>Can someone please help me fix the linq query or help create a new linq query from the sql. Thanks.</p>