Пример #1
0
        public OTPLogin OTPLogin([FromBody] OTPLogin login)
        {
            try
            {
                string connectionString = configuration.GetConnectionString("DefaultConnection");
                connectionFactory = ConnectionHelper.GetConnection(connectionString);

                var context = new DbContext(connectionFactory);

                var userRep = new CustomerRepository(context);
                var result  = userRep.OTPLogin(login);
                if (result != null)
                {
                    customerService.UpdateOTP(login.Username, login.OTP, true);
                    login.Message = "success";
                    return(login);
                }
                else
                {
                    login.Message = "Customer does not exist.";
                    return(login);
                }
            }
            catch (Exception ex)
            {
                login.Message = ex.Message;
                return(login);
            }
        }
Пример #2
0
        public CustomerModel OTPLogin(OTPLogin model)
        {
            try
            {
                using (var command = _context.CreateCommand())
                {
                    command.CommandType = CommandType.Text;
                    command.CommandText = $"select * from tblCustomer where OTP='{model.OTP}' and userName='******' and IsOTPUsed=0";

                    var result = this.ToList(command).FirstOrDefault();


                    return(result);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }