I have a single project that is both a Web API and MVC project. I have an MVC View that displays the results of an MVC controller query; I also expose the same data from the Web API controller.
My goal is to put a link on the View that will call the Web API and return the XML response as a file, passing in the same query that was used to generate the view.
What's a good way to implement this? For bonus points, can I parse the Web Api Route Name in my View to build the link?
EDIT
I have tried Slicksim's suggestion:
<a href="@Url.HttpRouteUrl("NameOfWebApiRoute", new { id = Model.Id })">
Testing 123
</a>
and that just displays the XML result in the browser window. My goal is to transfer this as an XML file, e.g. to show the Save As dialog and send it.