Ejemplo n.º 1
0
        public IActionResult Download(Guid id)
        {
            var file = _context.Files
                       .SingleOrDefault(e => e.Id == id);

            if (file == null)
            {
                return(NotFound());
            }
            var attachmentPath = Path.Combine(_hostingEnvironment.WebRootPath, "attachments", file.Id.ToString("N") + Path.GetExtension(file.Extension));

            return(PhysicalFile(attachmentPath, _mimeMappingService.GetContentType(file.Extension), file.Name));
        }