So I have registered the following route right now:
configuration.Routes.MapHttpRoute(
name: "MediaHandler",
routeTemplate: "api/mediahandler/{action}/{id}",
defaults: new { controller = "PortalAsset", id = RouteParameter.Optional }
);
And here is how the controller looks like:
public class MediaHandlerController : ApiControllerBase
{
///...
[HttpGet]
[ActionName("download")]
public async Task<HttpResponseMessage> DownloadAsset(long id)
{
// action
}
I want to add boolean parameter to the controller - isPreview and want to map the routhe the following way:
- http://host/api/mediahandler/download/1893 maps to:
id=1893,isPreview=false - http://host/api/mediahandler/download/1893/preview maps to:
id=1893,isPreview= true
Is there a way I can acomplish that?