public ActionResult MyAccount(RegisterModel model)
 {
     MembershipUser currentUser = Membership.GetUser(User.Identity.Name, true);
     currentUser.Email = model.Email;
     Membership.UpdateUser(currentUser);
     ProfileBase profile = ProfileBase.Create(currentUser.UserName);
     profile["BirthDate"] = model.BirthDate;
     profile["Gender"] = model.Gender;
     profile["Name"] = model.Name;
     profile["LastName"] = model.LastName;
     profile["CPF"] = model.CPF;
     profile.Save();
     return RedirectToAction("Index", "Home");
 }
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.Email, model.Password, model.Email, null, null, true, null, out createStatus);
                if (createStatus == MembershipCreateStatus.Success)
                {
                    ProfileBase profile = ProfileBase.Create(model.Email);
                    profile["BirthDate"] = model.BirthDate;
                    profile["Gender"] = model.Gender;
                    profile["Name"] = model.Name;
                    profile["LastName"] = model.LastName;
                    profile["CPF"] = model.CPF;
                    profile.Save();
                    FormsAuthentication.SetAuthCookie(model.Email, false /* createPersistentCookie */);
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
 public ActionResult MyAccount()
 {
     ViewBag.LegendTitle = "Editar Dados";
     var user = Membership.GetUser();
     ProfileBase profile = ProfileBase.Create(user.UserName);
     var model = new RegisterModel();
     model.Email = user.UserName;
     model.BirthDate = (DateTime)profile["BirthDate"];
     model.Gender = (string)profile["Gender"];
     model.Name = (string)profile["Name"];
     model.LastName = (string)profile["LastName"];
     model.CPF = (string)profile["CPF"];
     return PartialView("MyAccount", model);
 }