title: [System.DateTime])' has no supported translation to SQL
body: <p>I want to execute a query like this:</p>
  
  <pre><code>List&lt;supervisorAnswerQuesttionPres&gt; temp =
      (from i in dbconnect.tblAnswerLists
      where i.StudentNum == studentNumber
      select new supervisorAnswerQuesttionPres
      {
          answerList = _resAnswerList,
          questionList = _resQuestionist,
          date = ConvertToPersianToShow(i.dateOfAnswer.Value.Date)
      }).OrderBy(i =&gt; i.date).ToList();
  </code></pre>
  
  <p>My class that this query is returned is something like this :</p>
  
  <pre><code>public class supervisorAnswerQuesttionPres
  {
      public string date { set; get; }
      public List&lt;string&gt; questionList { set; get; }
      public List&lt;string&gt; answerList { set; get; }
  }
  </code></pre>
  
  <p>In this query i use a function to convert my Datetime to another presentation i use this function for this :</p>
  
  <pre><code>public string ConvertToPersianToShow(DateTime? datetime)
  {
      string date;
      DateTime dt;
  
      if (!datetime.HasValue) return "";
      dt = datetime.Value;
      //  dt = datetime;
  
      string year = Convert.ToString(persian_date.GetYear(dt));
      string month = Convert.ToString(persian_date.GetMonth(dt));
      string day = Convert.ToString(persian_date.GetDayOfMonth(dt));
  
      if (month.Length == 1)
      {
          month = "0" + Convert.ToString(persian_date.GetMonth(dt));
      }
  
      if (day.Length == 1)
      {
          day = "0" + Convert.ToString(persian_date.GetDayOfMonth(dt));
      }
  
      Convert.ToString(persian_date.GetMonth(dt)) + "/" +
              +                 dt.Minute + ")";
      date = year + "/" + month + "/" + day;
      return date;
  }
  </code></pre>
  
  <p>This function just convert my DateTime ,But when i execute the query i got this error:</p>
  
  <pre><code>Method 'System.String ConvertToPersianToShow(System.Nullable`1[System.DateTime])' has no supported translation to SQL. 
  </code></pre>