public ActionResult MyContactUpdate(MyProfileResponseParameters model) { Session["ChangedCountry"] = null; ViewData["SuggestedAddress"] = null; MyProfileResponseParameters Suggestion = new MyProfileResponseParameters(); ProfileService psService = new ProfileService(); if (ModelState.IsValid) { if (!model.Address_Country.Equals("us", StringComparison.CurrentCultureIgnoreCase)) { model.Address_City = ""; model.Address_State = ""; model.Address_ZipCode = ""; } if (model.correct_address != null && Session["suggestion"] != null) { var objectToConsider = model.correct_address == "no" ? (MyProfileResponseParameters)Session["suggestion"] : model; objectToConsider.isPaperLessSelected = model.isPaperLessSelected; var listOfServiceErrors = psService.UpdateProfileEmailAndDemoGraphics(objectToConsider); if (listOfServiceErrors.Count > 0) { if (listOfServiceErrors.Count == 1 && listOfServiceErrors.FirstOrDefault().ErrorMessage == "ShowUnsuccessMessage") { //Generic message Caused due to network issues ViewData["ShowUnsuccessMessage"] = "true"; } else { foreach (var vi in listOfServiceErrors) { ModelState.AddModelError("", vi.ErrorMessage); } } } else { ViewData["ShowSuccessMessage"] = "true"; ModelState.Clear(); } ViewData["SuggestedAddress"] = null; if (!string.IsNullOrEmpty(model.successPageUrl) && (string)ViewData["ShowSuccessMessage"] == "true") { RedirectToRegistrationSuccess(UrlMapper.Map(model.successPageUrl)); return(null); } else { return(base.Index()); } } var listOfError = ValidationUtils.GetMyProfileViolations(model); if (listOfError.Count == 0 && model.Address_Country.Equals("us", StringComparison.CurrentCultureIgnoreCase)) { listOfError = ValidationUtils.GetMelissaLookUpViolations(model, ref Suggestion); Session["suggestion"] = Suggestion; if (!string.IsNullOrEmpty(Suggestion.Address_AddressLine1)) { ViewData["SuggestedAddress"] = "true"; ViewData["SuggestedAddressDetail"] = ValidationUtils.AddressSuggestionFormat(Suggestion); ViewData["ActualAddressDetail"] = ValidationUtils.AddressSuggestionFormat(model); } else { if (listOfError.Count == 0) { ViewData["SuggestedAddress"] = null; } else { ViewData["SuggestedAddress"] = "false"; ViewData["ActualAddressDetail"] = ValidationUtils.AddressSuggestionFormat(model); } } } if (listOfError.Count > 0) { Session["ChangedCountry"] = model.Address_Country; foreach (var vi in listOfError) { ModelState.AddModelError("", vi.ErrorMessage); } } else { ViewData["SuggestedAddress"] = ViewData["SuggestedAddress"] == null ? null : ViewData["SuggestedAddress"]; if (ViewData["SuggestedAddress"] == null || ViewData["SuggestedAddress"].ToString() == "false") { var listOfServiceErrors = psService.UpdateProfileEmailAndDemoGraphics(model); if (listOfServiceErrors.Count > 0) { if (listOfServiceErrors.Count == 1 && listOfServiceErrors.FirstOrDefault().ErrorMessage == "ShowUnsuccessMessage") { //Generic message Caused due to network issues ViewData["ShowUnsuccessMessage"] = "true"; } else { foreach (var vi in listOfServiceErrors) { ModelState.AddModelError("", vi.ErrorMessage); } } } else { ViewData["ShowSuccessMessage"] = "true"; ModelState.Clear(); } } } } if (!string.IsNullOrEmpty(model.successPageUrl) && (string)ViewData["ShowSuccessMessage"] == "true") { RedirectToRegistrationSuccess(UrlMapper.Map(model.successPageUrl)); return(null); } else { return(base.Index()); } }