I'm building a mvc3 application which uses a SQL Server Database with a table named Field. this table has many columns.one of it's columns is File9Terme with string value and store a PDF file path that stores in a folder named BOOKS. I build a upload file for this. but now I want to build a download link for each PDF file. here is my code:
[HttpPost]
public FileResult Download(int id)
{
var document = db.Fields.First(f => f.FieldId == id);
var filename = document.File9Terme;
return File(filename, document.GetType().ToString());
}
and here is my Index view:
<td>
<%= Html.ActionLink("Download", "Download", "FieldController", new { id=item.FieldId })%>
</td>
where is the problem? thanks for help.