// GET: JobDetails public ActionResult DownloadCustomerCommunication(Guid id) { List <RCSExcel> mainlist = new List <RCSExcel>(); Job job = db.Job.Find(id); mainlist = manage.CustomerCommunicationForDownload(id); DataTable dt = excelutility.ConvertToDataTable(mainlist); FileClass file = new FileClass(); file = excelutility.WriteDataTableToExcel(dt, job.JobName, "Customer Communication"); if (file.FileContent != null) { return(File(file.FileContent, "application/vnd.ms-excel")); } else { ImageFile faoimagefile = db.ImageFile.Single(f => f.ImageFileKey == 1); return(File(faoimagefile.FileContent, faoimagefile.FileType)); } }