示例#1
0
        public ActionResult Generate(string qrCode)
        {
            var generator  = new QRCoder.QRCodeGenerator();
            var qRCodeData = generator.CreateQrCode(qrCode, QRCoder.QRCodeGenerator.ECCLevel.Q);
            var qRCoder    = new QRCoder.SvgQRCode(qRCodeData);
            var resultat   = qRCoder.GetGraphic(5);

            return(Ok(resultat));
        }
        public async Task <ActionResult> Generate()
        {
            //await authService.EnsureToken();

            var bagId   = Guid.NewGuid().ToString();
            var baseUrl = "https://bouvet-panther.azurewebsites.net/#/registerBag/";
            var qrCode  = baseUrl + bagId;

            var generator  = new QRCoder.QRCodeGenerator();
            var qRCodeData = generator.CreateQrCode(qrCode, QRCoder.QRCodeGenerator.ECCLevel.Q);
            var qRCoder    = new QRCoder.SvgQRCode(qRCodeData);
            var resultat   = qRCoder.GetGraphic(5);

            try
            {
                await bagRepository.AddNewAsync(bagId);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(Ok(resultat));
        }