public async Task <IActionResult> DownloadAttachment() { var currentUserId = User.Claims.ElementAt(0).Value; var fileContents = await _attachmentService.GenerateSowsListPdfAttachmentAsync(currentUserId); var fileName = string.Format("SpisLoch_{0}.pdf", DateTime.Today.ToShortDateString()); return(File(fileContents, "application/pdf", fileName)); }