Hi guys i have difficulties of passing my model to controller> I wonder if this is a good practice or is it possible to do so. Here's what i want to achieve.
<% foreach (DownloadFile file in Model){ %>
<a href="<%= Url.Action("DownloadFile", new { File = file}) %>">click here to download</a>
<% } >%
I want to pass the DownloadFile Object "file" to my controller that goes like this:
public ActionResult DownloadLabTestResult(DownloadFile File)
{
DownloadFile file = File;
...
return new FileStreamResult(Response.OutputStream, Response.ContentType);
}
I tried passing a string or integer and its doable. but when i want to pass an object like the above, i get a null value. What's the proper way to do this? thank u!