public ActionResult ChangeSecretQuestion(string txtSecretQuestion, string txtSecretAnswer) { try { IWebUserService webUserService = new WebUserService(); var studentNo = Session[SessionKeyStudentNo]; webUserService.UpdateSecretQuestionAnswer(int.Parse(studentNo.ToString()), txtSecretQuestion, txtSecretAnswer); // Get Student information ... var userInfo = GetStudentInfo(); ViewData["editOption"] = "csq"; // Record is updated. ViewData["successMsg"] = "1"; logger.Info("Secret question changed successfully of Student No." + Session[SessionKeyStudentNo]); return(View("UserSettings", userInfo)); } catch (Exception ex) { logger.Error("Secret question changed failded of Student No." + Session[SessionKeyStudentNo], ex); // Redirect to error page Response.Redirect("Result/error"); return(null); } }
public ActionResult ChangeSecretQuestion(FormCollection collection) { string txtSecretQuestion = collection["txtSecretQuestion"]; string txtSecretAnswer = collection["txtSecretAnswer"]; try { IWebUserService webUserService = new WebUserService(); var studentNo = Session[SessionKeyStudentNo]; webUserService.UpdateSecretQuestionAnswer(int.Parse(studentNo.ToString()), txtSecretQuestion, txtSecretAnswer); // Get Student information ... var userInfo = GetStudentInfo(); ViewData["editOption"] = "csq"; // Record is updated. ViewData["successMsg"] = "1"; logger.Debug("Secret question changed successfully for Student No." + Session[SessionKeyStudentNo]); return(View("UserSettings", userInfo)); } catch (Exception ex) { var sb = new StringBuilder(); sb.AppendFormat("Secret question change request failded for Student No:{0}. " + Session[SessionKeyStudentNo]); sb.AppendFormat("SecretQuestion: {0}, SecretAnswer: {1}", txtSecretQuestion, txtSecretAnswer); logger.Error(sb.ToString(), ex); // Redirect to error page Response.Redirect(AppHelper.SharedUrl("Reply/Error")); return(null); } }