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)); }
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)); }