title: How to add Month in date time and Compare with another date time in Linq?
body: <p>I have following controller action method  </p>
  
  <pre><code>public ActionResult BondCompletion(DateTime? ToDate)
      {
          List&lt;BondCompletionViewModel&gt; bondCompletionViewModel = new List &lt;BondCompletionViewModel&gt;();
          if (ToDate != null)
          {
              bondCompletionViewModel = db.Employees.Select(y =&gt; new 
              { 
                  y.JoiningDate ,
                  y.Commitments ,
                  y.EmployeeId ,
                  y.Name 
              })
              .Where(x =&gt; x.JoiningDate.AddMonths(x.Commitments.Value).Month == ToDate.Value.Month)
                  .Select(z =&gt; new BondCompletionViewModel
                  {
                      EmployeeId = z.EmployeeId.Value,
                      EmployeeName = z.Name,
                      StartDate = z.JoiningDate,
                      EndDate = z.JoiningDate//.AddMonths(x.Commitments.Value)
                  }).ToList();
          }
  
          return View(bondCompletionViewModel);
      }
  </code></pre>
  
  <p>In above method Commitments is nullable int and JoiningDate is datetime. when I run this if showing following error</p>
  
  <p>“<strong>LINQ to Entities does not recognize the method 'System.DateTime AddMonths(Int32)' method, and this method cannot be translated into a store expression.</strong>”</p>
  
  <p>Please guide me how to resolve this error.</p>