public ActionResult UserProfile(ProfileInformation profileInformation) { var profileBase = HttpContext.Profile; profileBase.SetPropertyValue("Subscription", profileInformation.SubscriptionField); profileBase.SetPropertyValue("Language", profileInformation.LanguageField); profileBase.SetPropertyValue("PersonalInformation.FirstName", profileInformation.FirstName); profileBase.SetPropertyValue("PersonalInformation.LastName", profileInformation.LastName); profileBase.SetPropertyValue("PersonalInformation.Gender", profileInformation.Gender); profileBase.SetPropertyValue("PersonalInformation.BirthDate", profileInformation.BirthDate); profileBase.SetPropertyValue("PersonalInformation.Occupation", profileInformation.Occupation); profileBase.SetPropertyValue("PersonalInformation.Website", profileInformation.Website); profileBase.SetPropertyValue("ContactInformation.Street", profileInformation.Street); profileBase.SetPropertyValue("ContactInformation.City", profileInformation.City); profileBase.SetPropertyValue("ContactInformation.State", profileInformation.State); profileBase.SetPropertyValue("ContactInformation.ZipCode", profileInformation.Zipcode); profileBase.SetPropertyValue("ContactInformation.Country", profileInformation.CountryField); profileBase.Save(); profileInformation.SubscriptionType = GetSubscriptionList(GetProfileValue("Subscription", profileBase)); profileInformation.Language = GetLanguageList(GetProfileValue("Language", profileBase)); profileInformation.Country = GetCountryList(GetProfileValue("ContactInformation.Country", profileBase)); profileInformation.GenderType = GetGenderList(GetProfileValue("PersonalInformation.Gender", profileBase)); ViewBag.SuccessMessage = "Your profile information has been saved"; ViewBag.PageTitle = "My Profile"; return View(profileInformation); }
public ActionResult UserProfile() { ProfileBase profileBase = HttpContext.Profile; var profileInformation = new ProfileInformation { FirstName = profileBase.GetPropertyValue("PersonalInformation.FirstName").ToString(), LastName = profileBase.GetPropertyValue("PersonalInformation.LastName").ToString(), BirthDate = (DateTime)profileBase.GetPropertyValue("PersonalInformation.BirthDate"), City = profileBase.GetPropertyValue("ContactInformation.City").ToString(), State = profileBase.GetPropertyValue("ContactInformation.State").ToString(), Zipcode = profileBase.GetPropertyValue("ContactInformation.ZipCode").ToString() }; var webSite = profileBase.GetPropertyValue("PersonalInformation.Website"); profileInformation.Website = webSite == null ? "" : webSite.ToString(); var streetAddr = profileBase.GetPropertyValue("ContactInformation.Street"); profileInformation.Street = streetAddr == null ? "" : streetAddr.ToString(); profileInformation.SubscriptionType = GetSubscriptionList(GetProfileValue("Subscription", profileBase)); profileInformation.Language = GetLanguageList(GetProfileValue("Language", profileBase)); profileInformation.Country = GetCountryList(GetProfileValue("ContactInformation.Country", profileBase)); profileInformation.GenderType = GetGenderList(GetProfileValue("PersonalInformation.Gender", profileBase)); ViewBag.PageTitle = "Manage Profile"; return View(profileInformation); }