Reputation: 3061
How do you declare the anchor element using Tag Helpers to call this method using the custom route?
[HttpGet("Account/{accountID}")]
public IActionResult Perormance(string accountID) {
return View(new AccountPerformance(accountID));
}
The following does not seem to work
<a class="nav-link" asp-controller="Account" asp-action="Performance" asp-route-accountID="@account.AccountID">@account.Name</a>
Upvotes: 0
Views: 435
Reputation: 218732
You are expected to provide a valid action method name as the asp-action
attribute value. Your action method name is Perormance
and you are passing Performance
as the value of asp-action attribute.
It should work as long as you use the same name for the action method and the asp-action attribute value. So change your action method name to Performance
.
[HttpGet("Account/{accountID}")]
public IActionResult Performance(string accountID)
{
return View(new AccountPerformance(accountID));
}
Upvotes: 2