Example #1
0
        public async Task <IActionResult> Download(int?id)
        {
            if (id == null)
            {
                return(NotFound("Report not found."));
            }
            var report = await _reportServices.GetReport(id.Value);

            if (report == null)
            {
                return(NotFound("Report not found."));
            }
            var userId = Convert.ToInt32(User.FindFirstValue(ClaimTypes.NameIdentifier));
            await _reportServices.AddToDownloadsCount(userId, id.Value);

            var data = await _blobServices.GetBlobAsync($"{report.Id}.pdf");

            return(File(data.Content, "application/pdf", $"{report.Title}.pdf"));
        }
Example #2
0
        public async Task <IActionResult> Download(int id)
        {
            var data = await _blobServices.GetBlobAsync(id + ".pdf");

            return(File(data.Content, data.ContentType));
        }