title: Why LINQ Query and Extension don't support conversion or rounding numbers?
body: <p>I try to round, format the numbers. But it doesn't seem to work in LINQ. I need to format, and round the numbers as the example below as your reference. Thank you for help. Exception I get.</p>
  
  <p>LINQ to Entities does not recognize the method '' method, and this method cannot be translated into a store expression.</p>
  
  <p>The anonymous type is important to round non decimal number and format to comma separated:</p>
  
  <p>B - 1000.5 the value must 1,001
  C - 1000.2 the value must 1,000
  D - 1080.588 the value must 1,081
  E - 1010.45 the value must 1,000</p>
  
  <p>Here's my code:</p>
  
  <pre><code> var result = _context.DwPropertyMasters.Where(x =&gt; x.ShowMapPoint == "Y")
                  .Select(x =&gt; new
                  {
                      x.LandId,
                      a = x.Development == null || x.Development == "" ? x.Location : x.Development,
                      x.MapPointX,
                      x.MapPointY,
                      AreaSize = x.AreaSize ?? 0,
                      Premium = x.Premium ?? 0,
                      b = (x.Premium == 0 ? null : x.Premium) * 100000000 / (x.AreaSize == 0 ? null : x.AreaSize) ?? 0,
                      c =
                      _context.DwPropertyDetails.Where(
                              z =&gt; (z.TransactionPrice &gt; 0 || z.TransactionPrice != null) &amp;&amp; z.LandId == x.LandId)
                          .GroupBy(z =&gt; z.LandId)
                          .Select(g =&gt;
                              (g.Sum(p =&gt; p.TransactionPrice) == 0 ? null : g.Sum(p =&gt; p.TransactionPrice)) /
                              (g.Sum(p =&gt; p.ActualSize) == 0 ? null : g.Sum(p =&gt; p.ActualSize)) ?? 0)
                          .FirstOrDefault(),
                      d =
                      ((x.AreaSize2 == 0 ? null : x.AreaSize2) == 0
                          ? 0
                          : (x.Premium == 0 ? null : x.Premium) * 100000000 / (x.AreaSize2 == 0 ? null : x.AreaSize2)) ??
                      0,
                      x.LandType,
                      e =
                      _context.DwPropertyDetails.Where(
                              y =&gt; (y.TransactionPrice &gt; 0 || y.TransactionPrice != null) &amp;&amp; y.LandId == x.LandId)
                          .Select(y =&gt; new
                          {
                              a = 1
                          }).Count()
                  });
  </code></pre>
  
  <p>This is the ViewModel:</p>
  
  <pre><code> var output = result.Select(x =&gt; new SearchViewModels
              {
                  LandId = x.LandId,
                  A = x.a,
                  MapPointX = x.MapPointX,
                  MapPointY = x.MapPointY,
                  AreaSize = x.AreaSize,
                  Premium = x.Premium,
                  B = x.b,
                  C = x.c,
                  D = x.d,
                  LandType = x.LandType,
                  E = x.e
              }).ToArray();
  </code></pre>
  
  <p>This is the Class of ViewModel:</p>
  
  <pre><code>public class SearchViewModels
      {
          public long LandId { get; set; }
          public string A { get; set; }
          public string MapPointX { get; set; }
          public string MapPointY { get; set; }
          public long? AreaSize { get; set; }
          public long? Premium { get; set; }
          public long? B { get; set; }
          public long? C { get; set; }
          public long? D { get; set; }
          public string LandType { get; set; }
          public long? E { get; set; }
      }
  </code></pre>