Esempio n. 1
0
        public async Task <ActionResult <Voucher> > GetVoucher([FromRoute] string code)
        {
            var voucher = await baseVoucherService.GetVoucherByCode(code);

            if (voucher == null)
            {
                return(NotFound(new { Message = "voucher not found" }));
            }
            return(Ok(voucher));
        }
Esempio n. 2
0
        public async Task <ActionResult <Voucher> > GetVoucher([FromRoute] string code)
        {
            string encryptedCode = CodeGenerator.Encrypt(code);
            var    voucher       = await baseVoucherService.GetVoucherByCode(encryptedCode);

            string decryptedCode = CodeGenerator.Decrypt(voucher.Code);

            voucher.Code = decryptedCode;
            if (voucher == null)
            {
                return(NotFound(new { Message = "voucher not found" }));
            }
            return(Ok(voucher));
        }