title: Linq query not fetching record
body: <p>I need to fetch a record from SQL table, I can fetch the data when I do in SQL query, but not in LINQ.</p>
  
  <p>My sql query is: </p>
  
  <pre><code>select sum(datediff(Day,2018-04-31,2018-04-30)) as dd 
    from lms03192018.dbo.LeaveRequestModels 
   where leaveTypeId = '1'  
         and requestUserId = '5dc64ba7-8cf8-45dd-80f2-a8700e7dad2e' 
         and FromDate = '2018-04-30'
  </code></pre>
  
  <p>It gives me result: 1.</p>
  
  <p>I want the same result from LINQ, but instead of hard code dates I have to use a variable and a view model date value. Below is my attempted code:</p>
  
  <pre><code>var month = new DateTime (userInputDate.Year, userInputDate.Month , 1);
                            var last = month.AddMonths(1).AddDays(-1);
                            var nextmonth = month.AddMonths(1);
  
  var diffMonthLeavesCount = leaveApprovedList
                                .Where(x =&gt; x.leaveTypeId == leaveTypeId 
                                            &amp;&amp; x.requestUserId == person.Id 
                                            &amp;&amp; x.FromDate.Month == userInputDate.Month 
                                            &amp;&amp; x.ToDate.Month == nextmonth.Month)
                                .Select(x =&gt; SqlMethods.DateDiffDay(last,x.FromDate))
                                .Sum();
  </code></pre>