title: How to retrieve millions with decimals from SQL table
body: <p>I've made a C# ASP.NET with Entity Framework, Repository Pattern and SQL.
  I want to retrieve two kind of numbers (Price &amp; Fuel).</p>
  
  <p>Price example:
  I want to retrieve 2,441.095, but it shows as 2441095,000 in SQL and 2441095,00 in ASP.NET. I have used decimal(18, 3).</p>
  
  <p>Fuel example:
  I want to retrieve 22.0, but it shows as 22.00 in ASP.NET. I use decimal(18, 1) for that.</p>
  
  <p><strong>From the controller class:</strong></p>
  
  <pre><code>// GET: Car/Details/5
          public ActionResult Details(int id)
          {
              var objCar = iCar.GetCarByID(id);
              var Car = new Car();
              Car.Id = id;
              Car.Name = objCar.Name;
              Car.Model = objCar.Model;
              Car.Year = objCar.Year;
              Car.Color = objCar.Color;
              Car.Fuel = objCar.Fuel;
              Car.Price = objCar.Price;
              return View(Car);
          }
  </code></pre>
  
  <p>From the Repository Pattern:</p>
  
  <pre><code>public Car GetCarByID(int Id)
          {
              return dbContext.Cars.Find(Id);
          }
  </code></pre>
  
  <p><strong>Razor:</strong></p>
  
  <pre><code>@model IEnumerable&lt;Car_Sales.Models.Car&gt;
  
  @{
      ViewBag.Title = "Index";
  }
  
  &lt;h2&gt;Index&lt;/h2&gt;
  
  &lt;p&gt;
      @Html.ActionLink("Create New", "Create")
  &lt;/p&gt;
  &lt;table class="table"&gt;
      &lt;tr&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Name)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Model)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Year)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Color)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Fuel)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Price)
          &lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
  @foreach (var item in Model) {
      &lt;tr&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Name)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Model)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Year)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Color)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Fuel)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Price)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
              @Html.ActionLink("Details", "Details", new { id=item.Id }) |
              @Html.ActionLink("Delete", "Delete", new { id=item.Id })
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  
  &lt;/table&gt;
  </code></pre>