Beispiel #1
0
        public ActionResult GenerateUserPhysicalIdentificator(GetUserImageViewModel userImage)
        {
            if (!string.IsNullOrWhiteSpace(userImage.UserIdentificator))
            {
                var user = _context.userRepository.GetUserById(userImage.UserIdentificator);

                if (user != null)
                {
                    string URL        = Url.VerifyUserCompetencesByQRLink(userImage.UserIdentificator, Request.Scheme);
                    string pathToIcon = Path.Combine(_environment.WebRootPath, "Image") + $@"\logo_ziad_medium_bitmap.bmp";

                    var userQRCode = _generatorQR.GenerateQRCodeFromGivenURL(URL, pathToIcon);

                    UserIdentificatorWithQRViewModel userData = _mapper.Map <UserIdentificatorWithQRViewModel>(user);
                    userData.QRCode = userQRCode;

                    if (userImage.Image != null)
                    {
                        using (var memoryStream = new MemoryStream())
                        {
                            userImage.Image.CopyToAsync(memoryStream);
                            userData.UserImage = memoryStream.ToArray();
                        }
                    }

                    return(View(userData));
                }

                return(RedirectToAction("BlankMenu", "Certificates"));
            }

            return(RedirectToAction("BlankMenu", "Certificates"));
        }
Beispiel #2
0
        public ActionResult GenerateUserPhysicalIdentificator(string userIdentificator)
        {
            if (!string.IsNullOrWhiteSpace(userIdentificator))
            {
                var user = _context.userRepository.GetUserById(userIdentificator);

                if (user != null)
                {
                    GetUserImageViewModel userImage = _mapper.Map <GetUserImageViewModel>(user);

                    return(View("GenerateUserPhysicalIdentificatorPreparation", userImage));
                }

                return(RedirectToAction("BlankMenu", "Certificates"));
            }

            return(RedirectToAction("BlankMenu", "Certificates"));
        }