public FileResult DownloadDoc(int Id)
        {
            //SupportingDocs supportdoc = CMSService.DownloadDocument(Id);
            SupportingDocs supportdoc = CMSService.DownloadFile(Id); // LMD: they were calling the wrong method.

            string folderName = System.Configuration.ConfigurationManager.AppSettings["_QualityAssuranceReviews"];

            var fileSavePath = Path.Combine(folderName, supportdoc.FileName);

            byte[] fileBytes = System.IO.File.ReadAllBytes(fileSavePath);

            return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, supportdoc.FileName));
        }
        public ActionResult UploadSupportDocs()
        {
            //int var = Request.Files.Count;
            //int[] fileIds = new int[var];

            List <SupportingDocs> Files = new List <SupportingDocs>();

            if (HttpContext.Request.Files.AllKeys.Any())
            {
                for (int i = 0; i <= HttpContext.Request.Files.Count; i++)
                {
                    var file = HttpContext.Request.Files["files" + i];
                    if (file != null)
                    {
                        //int folderid = Convert.ToInt32(Request.Form["folderId"]);

                        string folderName = System.Configuration.ConfigurationManager.AppSettings["_QualityAssuranceReviews"];

                        if (!Directory.Exists(folderName))
                        {
                            Directory.CreateDirectory(folderName);
                        }

                        var fileSavePath = Path.Combine(folderName, System.IO.Path.GetFileName(file.FileName));
                        file.SaveAs(fileSavePath);

                        SupportingDocs supportdoc = new SupportingDocs();
                        supportdoc.FileName    = System.IO.Path.GetFileName(file.FileName);
                        supportdoc.UserCreated = ViewBag.UserName;
                        //supportdoc.StatusDescription = CaseStatus.Submitted.ToString();
                        //supportdoc.UserCreated = ViewBag.UserName;
                        //supportdoc.UserUpdated = ViewBag.UserName;

                        int id = CMSService.UploadFile(supportdoc);

                        SupportingDocs doc = new SupportingDocs();

                        doc = CMSService.DownloadFile(id);

                        Files.Add(doc);
                    }
                }
            }

            //for (int i = 0; i < Request.Files.Count; i++)
            //{
            //    var file = Request.Files[i];

            //    SupportingDocs supportdoc = new SupportingDocs();
            //    supportdoc.ContentLength = file.ContentLength;
            //    supportdoc.ContentType = file.ContentType;
            //    supportdoc.FileName = file.FileName;
            //    supportdoc.InputStream = ConvertToBytes(file.InputStream, supportdoc.ContentLength);

            //    fileIds[i] = CMSService.UploadFile(supportdoc);

            //    SupportingDocs doc = new SupportingDocs();

            //    doc = CMSService.DownloadFile(fileIds[i]);

            //    Files.Add(doc);
            //}


            return(Json(new { Files, JsonRequestBehavior.AllowGet }));
        }