i would like to create a button in my details view .when clicking that button i want to download it from database , i upload it perfectly in my databese
CONTROLLER:
public ActionResult AddDocument(Document document)
{
if (document.UploadDocument != null)
{
using (var ms = new MemoryStream())
{
document.UploadDocument.InputStream.CopyTo(ms);
document.DocumentImage = ms.GetBuffer();
}
}
db.Documents.Add(document);
db.SaveChanges();
ModelState.Clear();
return View();
{
if (document.UploadDocument != null)
{
using (var ms = new MemoryStream())
{
document.UploadDocument.InputStream.CopyTo(ms);
document.DocumentImage = ms.GetBuffer();
}
}
db.Documents.Add(document);
db.SaveChanges();
ModelState.Clear();
return View();
}
ACTION:
| SNo | NAME | DESCRIPTION | DOWNLOAD | ||
|---|---|---|---|---|---|
| @sn | @Html.DisplayFor(s => item.Name) | @Html.DisplayFor(s => item.Description) | *@ | @Html.ActionLink((s=>item.DocumentImage),"DownloadFile") | *@@Html.ActionLink("Download","DownloadFile") |
Azeem AnzariPosted Aug 26, 2015, 5:38 AM