title: How I get RowNumber with Model In Entity Framework core
body: <p>I am working in MVC Core using EntityFramework. How can I get
  the row number in view in the table?</p>
  <p>My model is:</p>
  <pre><code>public class Provider{
  
          public int ProviderId { get; set; }
          public string Name { get; set; }
          public int DateOfBirth{ get; set; }
  }
  </code></pre>
  <p>Controller is:</p>
  <pre><code>public async Task&lt;IActionResult&gt; Index()
          {
              return View(await _context.Provider.ToListAsync());
          }
  </code></pre>
  <p>View Is:</p>
  <pre><code>@model IEnumerable&lt;Project.Provider&gt;
   @foreach (var item in Model) {
                    &lt;tr&gt;
                  &lt;td&gt;
                          #
                  &lt;/td&gt;
              &lt;td&gt;
                  @Html.DisplayFor(modelItem =&gt; item.ProviderId)
                
              &lt;/td&gt;
              &lt;td&gt;
                  @Html.DisplayFor(modelItem =&gt; item.Name)
              &lt;/td&gt;
              &lt;td&gt;
                  @Html.DisplayFor(modelItem =&gt; item.DateOfBirth)
              &lt;/td&gt;
              &lt;td&gt;
                  @Html.DisplayFor(modelItem =&gt; item.DateOfBirth)
               &lt;/td&gt;
      }
  </code></pre>
  <p>output:</p>
  <pre><code>100 | Foo | 10/10/1990|
  101 | Bar | 10/10/1990|
  </code></pre>
  <p>I want a row number at the start, output like:</p>
  <pre><code>1|100 | Foo | 10/10/1990|
  2|101 | Bar | 10/10/1990|
  </code></pre>