In my controller I do have this endpoint:
async Task<FileResult> DownloadSelection(AssignedDatabaseSelection selection)
And my HTML looks like:
@if (Model.AssignedDatabaseSelections.Any())
{
<table>
@foreach (var selection in Model.AssignedDatabaseSelections)
{
<tr>
<td>@selection.DisplayName</td>
<td width="10%">
@Html.ActionLink(Strings.CsvLabel, "DownloadSelection", "Home", selection, null)
</td>
</tr>
}
</table>
}
Now I wanted to add another parameter to my controller method:
async Task<FileResult> DownloadSelection(AssignedDatabaseSelection selection, DownloadFormat format)
And
@if (Model.AssignedDatabaseSelections.Any())
{
<table>
@foreach (var selection in Model.AssignedDatabaseSelections)
{
<tr>
<td>@selection.DisplayName</td>
<td width="10%">
@Html.ActionLink(Strings.CsvLabel, "DownloadSelection", "Home", new {selection = selection, Format = DownloadFormat.CSV}, null)
</td>
<td width="10%">
@Html.ActionLink(Strings.ExcelLabel, "DownloadSelection", "Home", new { selection = selection, Format = DownloadFormat.CSV }, null)
</td>
</tr>
}
</table>
}
When I make an inspect elements I got this:
<a href="/Home/DownloadSelection?selection=System.Data.Entity.DynamicProxies.AssignedDatabaseSele_D02B1D7B1220921CC4150FAA016EB8BFD5692B52C49949B0ECB80AA2F98E7355&Format=CSV">Excel</a>
Now, the format is filled, but the selection is always null. What am I missing?
formatparameter?selection?