title: My Id Key doesn't "restart" and always only increments in database during POST request
body: <p>I'm trying to create an application using Angular and Web API for some simple CRUD operations.</p>
  <p>I succeeded in connecting the Web API and Angular to my database, but whenever I make a <code>POST</code> request (even if I don't have anything in my database), my Id starts from the &quot;remembered&quot; last number of <code>TimeId</code> and I would like for it to start from 1 if my database is empty.</p>
  <p>Can anyone tell me why is this happening and how to fix this?</p>
  <p>I made my <code>POST</code> request and it looks like this in database:</p>
  <p><a href="https://i.stack.imgur.com/8DIhf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8DIhf.jpg" alt="enter image description here" /></a></p>
  <p>Now if I delete this using <code>TimeId</code> (using Swagger) my database will be empty.</p>
  <p>But if I try to make another <code>POST</code> request, my <code>TimeId</code> will not start from 1 but from 35:</p>
  <p><a href="https://i.stack.imgur.com/S6ZVb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S6ZVb.jpg" alt="enter image description here" /></a></p>
  <p>My <code>POST</code> methods in the Web API are:</p>
  <pre><code>[HttpPost]
  public async Task&lt;ActionResult&lt;Time&gt;&gt; PostTime(Time time)
  {
      _context.Times.Add(time);
      await _context.SaveChangesAsync();
      return CreatedAtAction(&quot;GetTime&quot;, new { id = time.TimeId }, time);
  }
  </code></pre>
  <p>and <code>GetTime</code> method is:</p>
  <pre><code>[HttpGet(&quot;{id}&quot;)]
  public async Task&lt;ActionResult&lt;Time&gt;&gt; GetTime(int id)
  {
      var time = await _context.Times.FindAsync(id);
   
      if (time == null)
      {
          return NotFound();
      }
  
      return time;
  }
  </code></pre>
  <p>When I do the <code>POST</code> request from Angular side, the same thing happens, but I suppose this is because Angular is using <code>POST</code> method from the Web API.</p>