Given the following HTML:
<li>
<a asp-area="" asp-controller="Product" asp-action="Products" asp-route-id="0">
<i class="si si-drop"></i>
<span class="sidebar-mini-hide">EnerBurn</span>
</a>
</li>
produces this URL:
But in this controller action, the selected variable is always 0.
Why isn't the controller action picking up the id from the URL route?
This is the HttpGet
controller action:
public IActionResult Products(int selected)
{
var pivm = new ProductInfoViewModel {SelectedId = selected};
pivm= UpdateModelFromSelectedId(pivm);
return View(pivm);
}
id
– Ehsan Sajjad