public JsonResult ValidateOTP(string jsonData) { ChitaleSPResponse objOTPData = new ChitaleSPResponse(); try { JavaScriptSerializer json_serializer = new JavaScriptSerializer(); json_serializer.MaxJsonLength = int.MaxValue; object[] objData = (object[])json_serializer.DeserializeObject(jsonData); foreach (Dictionary <string, object> item in objData) { string Type = Convert.ToString(item["Type"]); string CashIncentive = Convert.ToString(item["CashIncentive"]); string Infrastructure = Convert.ToString(item["Infrastructure"]); string Deposit = Convert.ToString(item["Deposit"]); string Promotion = Convert.ToString(item["Promotion"]); string OTP1 = Convert.ToString(item["OTP1"]); string OTP2 = Convert.ToString(item["OTP2"]); objOTPData = RR.ValidateOTP(Type, CashIncentive, Infrastructure, Deposit, Promotion, OTP1, OTP2); } } catch (Exception ex) { newexception.AddException(ex); } return(new JsonResult() { Data = objOTPData, JsonRequestBehavior = JsonRequestBehavior.AllowGet, MaxJsonLength = Int32.MaxValue }); }
public ChitaleSPResponse ValidateOTP(string Type, string CashIncentive, string Infrastructure, string Deposit, string Promotion, string OTP1, string OTP2) { ChitaleSPResponse objData = new ChitaleSPResponse(); using (var context = new ChitaleDBContext()) { objData = context.Database.SqlQuery <ChitaleSPResponse>("sp_RedemptionValues @pi_LoginId, @pi_CashIncentive, @pi_InfraStructure, @pi_Deposit, @pi_Promotion, @pi_Datetime,@pi_Type,@pi_OTPValue1,@pi_OTPValue2", new SqlParameter("@pi_LoginId", ""), new SqlParameter("@pi_CashIncentive", CashIncentive), new SqlParameter("@pi_InfraStructure", Infrastructure), new SqlParameter("@pi_Deposit", Deposit), new SqlParameter("@pi_Promotion", Promotion), new SqlParameter("@pi_Datetime", DateTime.Now.ToString("dd-MM-yyyy")), new SqlParameter("@pi_Type", Type), new SqlParameter("@pi_OTPValue1", OTP1), new SqlParameter("@pi_OTPValue2", OTP2)).FirstOrDefault <ChitaleSPResponse>(); } return(objData); }