Question

In ASP.NET Web API, I have a action method, that look like this:

    [GET("?{optionalValue:int?}"), HttpGet]
    public HttpResponseMessage Search(int? optionalValue = null)

How do I make a link, without the optionalValue parameter, using hyprlinkr?

Tried:

linker.GetUri<MyController>(c => c.Search(null).ToString()

which throws a NullReferenceException, the same does

linker.GetUri<MyController>(c => c.Search(new int?()).ToString()

TIA

Was it helpful?

Solution

Nullable seems to be supported with the latest version 1.0.1 of HyprLinkr, just use:

linker.GetUri<MyController>(c => c.Search(new int?()).ToString()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top