public async Task<ActionResult> CheckQuestions(List<QuestionModel> questionnair) { Session["DisableMenu"] = "No"; bool questionFailed = false; if (questionnair != null) { foreach (var question in questionnair) { if (question.correctAnswer[0] != question.response[0]) questionFailed = true; } } if (questionFailed) { return RedirectToAction("Fail", "Questionnaire"); } if (((string)Session["Status"]).CompareTo("LoggedIn") == 0) { using (var client = new DataServiceClient()) { if (!await client.updateJobIdsAsync(Convert.ToInt32(Session["ApplicantId"]), (int[])this.Session["jobIds"])) { //error storing jobIds (when logged in this is stored after questionnair) } else { this.Session["LocalJobs"] = "Done"; } } } return RedirectToAction("Index","PersonalInfo"); }
public async Task<ActionResult> Index(PersonalInfoModel model) { int tempId = -1; var auth = new ApplicantAuth(); var personalInfo = new PersonalInfo(); if (ModelState.IsValid) { personalInfo.firstName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.name_first.ToLower()); personalInfo.middleName = model.name_middle == null ? model.name_middle : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.name_middle); personalInfo.lastName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.name_last.ToLower()); personalInfo.alias = model.name_alt == null? model.name_alt : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.name_alt.ToLower()); personalInfo.street = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.street.ToLower()); personalInfo.city = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.city.ToLower()); personalInfo.state = model.state.ToUpper(); personalInfo.email = model.email; personalInfo.zip = model.zip; personalInfo.Phone = model.phone_num; personalInfo.socialNum = model.ssn; personalInfo.applicantId = Convert.ToInt32(Session["ApplicantId"]); using (var client = new DataServiceClient()) { client.Open(); tempId = await client.updatePersonalInfoAsync(personalInfo); if (tempId > 0) { if (((string)Session["Status"]).CompareTo("LoggedIn") != 0) { if (!await client.updateJobIdsAsync(tempId, (int[])this.Session["jobIds"])) { //error storing jobIds (when logged in this is stored after questionnair) } else { this.Session["LocalJobs"] = "Done"; } } this.Session["ApplicantId"] = tempId; this.Session["PersonalInfo"] = "Done"; auth.applicantId = tempId; auth.password = model.password; if (!await client.updatePasswordAsync(auth)) { //error saving password } Session["Status"] = "LoggedIn"; return RedirectToAction("Index", "Availability"); } else { //error occured, update failed } client.Close(); } } return View(model); }