Esempio n. 1
0
        public FileResult Download(int id)
        {
            FileRepository repository = new FileRepository(context);
            string         path       = repository.GetFilePath(id);

            //var result = new HttpResponseMessage(HttpStatusCode.OK) {
            //    Content = new StreamContent(fileService.GetStream(path))
            //};
            //result.Content.Headers.ContentDisposition =
            //    new ContentDispositionHeaderValue("attachment") {
            //        FileName = path
            //    };
            //result.Content.Headers.ContentType =
            //    new MediaTypeHeaderValue("application/octet-stream");

            return(File(fileService.GetBytes(path), "application/octet-stream", Path.GetFileName(path)));
        }