AspMvcAction annotation with default controller

Viewed 75

I am using jquery autocomplete, the source is provided with jquery ajax, calling my AutocompleteController. The AutocompleteController has different Actions, like GetCustomers, GetItems, GetCountries, ...

This is my UrlHelper extension method:

public static string Autocomplete(this UrlHelper url, [AspMvcAction] string actionName, [AspMvcController] string controller = "Autocomplete")
{
  return url.Action(actionName, controller, new { area = "" });
}

And in Razor:

@Url.Autocomplete("GetCountries", "Autocomplete")

working

Because of the [AspMvcAction] and [AspMvcController] the intellisense is working without problems. But the controller parameter in the @Url.Autocomplete is redundant, so I would rather have:

@Url.Autocomplete("GetCountries")

error

But in this case ReSharper searches the action (GetCountries in this case) in the controller of the current view, that's why it cannot find it (Cannot resolve action 'GetCountries').

Any ideas how to convince ReSharper to look in the Autocomplete controller?

PS - the problem is only with intellisense, the code works in both cases.

1 Answers
Related