Your view code is generating an GET request which is not reaching the Delete
action method, because it is marked with [HttpPost]
attribute.
To generate a POST request, and reach your Delete
method, modify your view code as -
<form asp-action="Delete">
<input type="submit" value="Delete" class="btn btn-link"/>
</form>
Also, replace [HttpPost]
with [HttpPost, ActionName("Delete")]
on the action method, just to be sure.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…