// GET: /ProcessReview/GetDocument
public ActionResult GetDocument(int docId)
{
try
{
string filename = null;
IDocumentsRepository rep = new DocumentsRepository();
var document = rep.getDocumentByID(docId);
if (document == null)
{
return null;
}
filename = document.DocPath + "\\" + document.DocName;
string contentType = "";
if (filename.IndexOf(".pdf") > -1)
contentType = "application/pdf";
else if (filename.IndexOf(".doc") > -1)
contentType = "application/msword";
else if (filename.IndexOf(".com") > -1)
contentType = "text/html";
else if (filename.IndexOf(".txt") > -1)
contentType = "text/plain";
if (!contentType.Equals(""))
return new FilePathResult(filename, contentType);
else
return null;
}
catch (Exception e)
{
return null;
}
return null;
}