public Object DownloadFile(String uniqueName)
        {
            HttpContext.Current.Response.AppendHeader("Access-Control-Allow-Origin", "*");

            //Physical Path of Root Folder
            string rootPath = System.Web.HttpContext.Current.Server.MapPath("~/UploadedFiles");

            FileModel.GetFilesInPath(rootPath);
            //Find File from DB against unique name
            FileDTO fileDTO = FileModel.GetFileByUniqueID(uniqueName);

            if (fileDTO != null)
            {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
                var fileFullPath             = System.IO.Path.Combine(rootPath, fileDTO.FileUniqueName + fileDTO.FileExt);

                byte[] file = System.IO.File.ReadAllBytes(fileFullPath);
                System.IO.MemoryStream ms = new System.IO.MemoryStream(file);

                response.Content = new ByteArrayContent(file);
                response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
                //String mimeType = MimeType.GetMimeType(file); //You may do your hard coding here based on file extension

                response.Content.Headers.ContentType = new MediaTypeHeaderValue(fileDTO.ContentType);// obj.DocumentName.Substring(obj.DocumentName.LastIndexOf(".") + 1, 3);
                response.Content.Headers.ContentDisposition.FileName = fileDTO.FileActualName + fileDTO.FileExt;
                return(response);
            }
            else
            {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NotFound);
                return(response);
            }
        }
        public Object RemoveFile(String uniqueName)
        {
            HttpContext.Current.Response.AppendHeader("Access-Control-Allow-Origin", "*");
            //Physical Path of Root Folder
            string rootPath = System.Web.HttpContext.Current.Server.MapPath("~/UploadedFiles");

            //Find File from DB against unique name
            FileDTO fileDTO = FileModel.GetFileByUniqueID(uniqueName);

            if (fileDTO != null)
            {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
                var fileFullPath             = System.IO.Path.Combine(rootPath, fileDTO.FileUniqueName + fileDTO.FileExt);

                File.Delete(fileFullPath);

                return(response);
            }
            else
            {
                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NotFound);
                return(response);
            }
        }