public ActionResult UpdateDocument(Models.DocumentFileModel documentModel, HttpPostedFileBase document_update) { try { byte[] hold = new byte[document_update.ContentLength]; document_update.InputStream.Read(hold, 0, document_update.ContentLength); documentModel.FileName = document_update.FileName; documentModel.MimeType = document_update.ContentType; documentModel.DocumentData = hold; documentModel.UpdateFile(); } catch (Exception e) { } return(Redirect(Request.UrlReferrer.ToString())); }
public ActionResult Download(int id) { Dictionary <string, string> documentDict = new Models.DocumentFileModel().DownloadFile(id); if (documentDict.Keys.Count > 0) { System.Net.Mime.ContentDisposition cd = new System.Net.Mime.ContentDisposition { FileName = documentDict["File_Name"], Inline = false, }; Response.AppendHeader("Content-Disposition", cd.ToString()); return(File(Convert.FromBase64String(documentDict["Base64_Encoded_File"]), documentDict["Mime_Type"])); } else { return(Redirect("/Error/404")); } }