Example #1
0
        public IActionResult RedeemCode([FromRoute] string code)
        {
            var sql           = new SQL(_config.GetConnectionString("SQLConnnection"));
            var codeConverter = new CodeConverter(_config.GetSection("Base26")["Alphabet"]);
            var seedValue     = codeConverter.ConvertFromCode(code);

            sql.CheckIfCodeCanBeRedeemed(seedValue, code);

            return(Ok());
        }
Example #2
0
        public IActionResult RedeemCode([FromRoute] string code, [FromBody] string email)
        {
            var sql = new SQL(connectionString: _config.GetConnectionString("Storage"));

            var alphabet = new CodeConverter(_config.GetSection("Base26")["Alphabet"]);

            var seedValue = alphabet.ConvertFromCode(code);

            var redeemed = sql.CheckIfCodeCanBeRedeemed(seedValue, email);


            if (redeemed)
            {
                return(Ok());
            }
            return(BadRequest());
        }