Here I can't able to check the if condition (data) value from thread method. it's directly return the else part. based on the thread value I need to check the conditions. how can I achieve please help me.
public ActionResult Registration(VMAccount vm)
{
try
{
var existUser = accountBusiness.GetPhoneData(vm.Mobile);
if (existUser.Count == 0)
{
string data = "";
//vm.CreatedBy = GetAdminID();
//vm.ModifiedBy = vm.CreatedBy;
vm.Role = AppRole.Consumer;
int retValue = accountBusiness.ConsumerRegistration(vm);
if (retValue == 1)
{
new Thread(() =>
{
// string mobile = "1235896325";
data = sms.SendRegistrationOtp(vm.Mobile);
//data= sms.SendRegistrationOtp(mobile);
}).Start();
}
if(data=="Pending")
{
return Json(2, JsonRequestBehavior.AllowGet);
}
else
{
return Json(3, JsonRequestBehavior.AllowGet);
}
}
else
{
return Json(1, JsonRequestBehavior.AllowGet);
}
}
catch (Exception ex)
{
log.Error("Admin-InsertAccountDetails", ex);
return Json(0, JsonRequestBehavior.AllowGet);
}
}