public ActionResult Verification() { VerificationModel VerificationModel = new VerificationModel(); return View(); }
public ActionResult Verification(VerificationModel VerificationModel) { try { var UserId = VerificationModel.UserId; var piPhoneNumber = VerificationModel.PhoneNumber; if (UserId == null) { ModelState.AddModelError("errorUserId", "用户ID为空,请输入用户ID"); return View(); } else if (piPhoneNumber == null) { ModelState.AddModelError("errorPhoneNo", "手机号码为空,请输入手机号码"); return View(); } else { var UserExistFlag = _ServicesSoapClient.CheckUserExist(UserId); if (UserExistFlag == true) { var Role = _ServicesSoapClient.GetClassByUserId(UserId); if (Role == "Doctor" || Role == "Administrator") { var CheckDoctorPhoneNumber = _ServicesSoapClient.CheckDoctorPhoneNumber(UserId, piPhoneNumber); if (CheckDoctorPhoneNumber == 1) { return RedirectToAction("ResetPassword", "Account", new { UserId = UserId }); } else { ModelState.AddModelError("errorPhoneNo", "输入的手机号码错误"); return View(); } } else if (Role == "Patient") { var CheckPatientPhoneNumber = _ServicesSoapClient.CheckPatientPhoneNumber(UserId, piPhoneNumber); if (CheckPatientPhoneNumber == 1) { return RedirectToAction("ResetPassword", "Account", new { UserId = UserId }); } else { ModelState.AddModelError("errorPhoneNo", "输入的手机号码错误"); return View(); } } else { return View(); } } else { ModelState.AddModelError("errorUserId", "该用户不存在"); return View(); } } } catch (Exception) { ModelState.AddModelError("errorConnection", "数据库连接失败"); return View(); } }
public ActionResult Verification(VerificationModel VerificationModel) { try { var piPhoneNumber = VerificationModel.PhoneNumber; if (piPhoneNumber == null) { ModelState.AddModelError("errorPhoneNo", "手机号码为空,请输入手机号码"); return View(); } else { string UserId = _ServicesSoapClient.GetIDByInput("PhoneNo", piPhoneNumber); return RedirectToAction("ResetPassword", "Account", new { UserId = UserId }); } } catch (Exception) { ModelState.AddModelError("errorConnection", "数据库连接失败"); return View(); } }