Pregunta

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

¿Fue útil?

Solución

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()
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top