public FileContentResult DownloadFile(string id) { Byte[] bytes = Qrcoder.GetQrFile(id); Response.Headers.Add("Content-Disposition", "attachment; filename=\"abonement.png\""); Response.Headers.Add("Content-Type", "application/force-download"); return(File(bytes, "image/png")); }
public async Task <IActionResult> Index() { AppUser currentUser = await _userService.GetUserAsync(HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier)); if (currentUser != null) { Qrcoder.CreateQrFile(currentUser.Id); Byte[] qrFromFile = Qrcoder.GetQrFile(currentUser.Id); ViewBag.LoadedQrFile = qrFromFile; if (!currentUser.IsActive) { ViewBag.ErrorMessage = "Ваш акаунт заблоковано. Будь ласка зв'яжiться з адмiністріцією."; } } else { await _signInManager.SignOutAsync(); return(RedirectToAction(nameof(Index))); } return(View(currentUser)); }