public async Task <IActionResult> CheckOTP(CheckOTP request) { dt = new DataTable(); dt = await acc.CheckOTP(request.phoneNumber, request.refOTP); OTPResultModel response = new OTPResultModel(); if (dt.Rows.Count == 0) { response.message = "mismatch"; return(NotFound(response)); } if (dt.Rows[0]["Result"].ToString() == "NotFound") { dc = new Dictionary <string, string>(); dc.Add("result", "OTP Mismatch"); return(NotFound(dc)); } else if (dt.Rows[0]["Result"].ToString() == "OTP Expire") { dc = new Dictionary <string, string>(); dc.Add("result", dt.Rows[0]["Result"].ToString()); return(NotFound(dc)); } // await acc.DisableCurrentOTP(request.phoneNumber, request.OTP); response.message = "match"; return(Ok(response)); }
// Check OPT public Boolean CheckOTP(int uId, CheckOTP checkOTP) { Boolean flag = false; try { //get User Id int otp = checkOTP.OTP; if (uId != 0 && otp != 0) { using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("spCDFGetOTP", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@token", checkOTP.OTP); cmd.Parameters.AddWithValue("@uId", uId); con.Open(); SqlDataReader sdr = cmd.ExecuteReader(); if (sdr.HasRows) { flag = true; } else { flag = false; } } } return(flag); } catch (Exception ex) { Log.Error("" + ex); return(flag); } }
//post api //Check OTP is correct public Boolean Post(int id, [FromBody] CheckOTP checkOTP) { return(fp.CheckOTP(id, checkOTP)); }