public ActionResult EditProfile() { ProfileViewModel profileViewModel = new ProfileViewModel(); if (Session["user"] == null) return RedirectToAction("Login", "Account"); profileViewModel.Heights = GetAllHeights(); profileViewModel.Occupations = GetAllOccupations(); var temp = (UserProfileModel) Session["user"]; profileViewModel.UserProfile = _entityUser.GetUser(temp.Email).MapServerToClient(); profileViewModel.DateOfBirthString = profileViewModel.UserProfile.DateOfBirth.ToShortDateString(); return View(profileViewModel); }
public ActionResult EditProfile(ProfileViewModel user) { var temp = (UserProfileModel) Session["user"]; if (_entityUser.UpdateProfile(user.UserProfile.MapClientToServer())) { ViewBag.changed = true; temp = _entityUser.GetUser(temp.Email).MapServerToClient(); Session["user"] = temp; return RedirectToAction("EditProfile", Session["user"]); } return View("Error"); }