Sorry in advance for my question being maybe kind of vague. I just don't know how to necessarily phrase it properly.
When I attempt to delete from my database, the data id is still present and when I add new data to the table the id continues to increase.
My controller:
[HttpGet]
    public ViewResult Delete(int id)
    {
        var product = context.Products
                        .FirstOrDefault(c => c.ProductId == id);
        return View(product);
    }
    [HttpPost]
    public RedirectToActionResult Delete(Product product)
    {
        context.Products.Remove(product);
        context.SaveChanges();
        return RedirectToAction("List", "Product");
    }
My View for where I list the items:
@foreach (Product product in Model)
    {
        <tr>
            <td>@product.Code</td>
            <td>@product.Name</td>
            <td>$@product.Price</td>
            <td>@product.ReleaseDate</td>
            <td>
                <a asp-controller="Product" asp-action="Edit"
                   asp-route-id="@product.ProductId" class="btn btn-primary">Edit</a>
            </td>
            <td>
                <a asp-controller="Product" asp-action="Delete"
                   asp-route-id="@product.ProductId" class="btn btn-primary">Delete</a>
            </td>
        </tr>
    }
My View for the delete action:
<form asp-action="Delete" method="post">
<input type="hidden" asp-for="ProductId" />
<div>
    <button type="submit" class="btn btn-primary">Delete</button>
    <a asp-controller="Product" asp-action="List" class="btn btn-primary">Cancel</a>
</div>
What am I doing wrong here? or if nothing is wrong why does it behave the way it does in terms of the id field.
 
     
     
    
