public ActionResult UserProfile(ProfileInformation profileInformation) { ProfileBase profileBase = HttpContext.Profile as ProfileBase; profileBase.SetPropertyValue("Subscription", profileInformation.SubscriptionType); profileBase.SetPropertyValue("Language", profileInformation.Language); profileBase.SetPropertyValue("PersonalInformation.FirstName", profileInformation.FirstName); profileBase.SetPropertyValue("PersonalInformation.LastName", profileInformation.LastName); profileBase.SetPropertyValue("PersonalInformation.Gender", profileInformation.GenderType); if (profileInformation.BirthDate != null) { 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.Country); profileBase.Save(); //ViewData["subscriptionType"] = ProfileInformation.GetSubscriptionList(profileBase.GetPropertyValue("Subscription").ToString()); //ViewData["genderType"] = ProfileInformation.GetGenderList(profileBase.GetPropertyValue("PersonalInformation.Gender").ToString()); //ViewData["country"] = ProfileInformation.GetLanguageList(profileBase.GetPropertyValue("ContactInformation.Country").ToString()); //ViewData["occupation"] = ProfileInformation.GetOccupationList(profileBase.GetPropertyValue("PersonalInformation.Occupation").ToString()); //ViewData["language"] = ProfileInformation.GetLanguageList(profileBase.GetPropertyValue("Language").ToString()); TempData["SuccessMessage"] = "Your profile information has been saved"; return View(profileInformation); }
public ActionResult UserProfile() { string id = HttpContext.User.Identity.Name.ToString(); ProfileBase profileBase; if (!String.IsNullOrEmpty(id)) { profileBase = ProfileBase.Create(id); } else { profileBase = HttpContext.Profile as ProfileBase; } //ViewData["subscriptionType"] = ProfileInformation.GetSubscriptionList(profileBase.GetPropertyValue("Subscription").ToString()); //ViewData["genderType"] = ProfileInformation.GetGenderList(profileBase.GetPropertyValue("PersonalInformation.Gender").ToString()); //ViewData["country"] = ProfileInformation.GetLanguageList(profileBase.GetPropertyValue("ContactInformation.Country").ToString()); //ViewData["occupation"] = ProfileInformation.GetOccupationList(profileBase.GetPropertyValue("PersonalInformation.Occupation").ToString()); //ViewData["language"] = ProfileInformation.GetLanguageList(profileBase.GetPropertyValue("Language").ToString()); ProfileInformation profileInformation = new ProfileInformation() { FirstName = profileBase.GetPropertyValue("PersonalInformation.FirstName").ToString(), LastName = profileBase.GetPropertyValue("PersonalInformation.LastName").ToString(), BirthDate = (DateTime)profileBase.GetPropertyValue("PersonalInformation.BirthDate"), Website = profileBase.GetPropertyValue("PersonalInformation.Website").ToString(), Street = profileBase.GetPropertyValue("ContactInformation.Street").ToString(), City = profileBase.GetPropertyValue("ContactInformation.City").ToString(), State = profileBase.GetPropertyValue("ContactInformation.State").ToString(), Zipcode = profileBase.GetPropertyValue("ContactInformation.ZipCode").ToString() }; return View(profileInformation); }