Reputation: 1300
MVC controller code is:
[Route("Home-Appliances")]
public async Task<ActionResult> homeappliances(string q = "", string tags = null, int minPrice = 0, int maxPrice = 50000, bool accessories = false, string condition = null, int? page = null)
{
//my stuff...
}
How can I call this method from view using html helpers?
Note: I don't want to call this by action name. I have to call this by route specified i.e, Home-Appliances
Upvotes: 0
Views: 307
Reputation: 239200
"Home-Appliances" is not the route name, it's the URL. If you want to call it by route name, you need to pass a name:
[Route("Home-Appliances", Name = "HomeAppliances")]
Then, you can do:
Url.RouteUrl("HomeAppliances")
Upvotes: 2