public ActionResult CountrySelection(SelectCountryViewModel model) { bool countryChanged = false; // If we are changing the country from what was set before, we want to clear out the cart items before proceeding if (PropertyBag.ShippingAddress != null && !PropertyBag.ShippingAddress.Country.IsEmpty()) { if (PropertyBag.ShippingAddress.Country != model.SelectedCountry) { Exigo.PropertyBags.Delete(ShoppingCart); Exigo.PropertyBags.Delete(PropertyBag); countryChanged = true; } } // Set the selected country PropertyBag.ShippingAddress = new ShippingAddress { Country = model.SelectedCountry }; Exigo.PropertyBags.Update(PropertyBag); Utilities.SetCurrentCountry(model.SelectedCountry); // Set the selected language for the entire site var cultureCode = GlobalSettings.Globalization.AvailableLanguages.FirstOrDefault(l => l.LanguageID == model.SelectedLanguageID).CultureCode; Utilities.SetCurrentLanguage(cultureCode); if (countryChanged) { return RedirectToAction("personalinfo"); } else { return LogicProvider.GetNextAction(); } }
public ActionResult CountrySelection() { var model = new SelectCountryViewModel(); if (PropertyBag.ShippingAddress != null && !PropertyBag.ShippingAddress.Country.IsEmpty()) { model.SelectedCountry = PropertyBag.ShippingAddress.Country; model.SelectedLanguageID = Utilities.GetCurrentSelectedLanguage().LanguageID; } return View(model); }