public ActionResult Manage(UserProfile model) { using (var dbContext = new UsersContext()) { var user = dbContext.UserProfiles.Find(WebSecurity.GetUserId(User.Identity.Name)); return View(user); } }
public ActionResult ChangeProfile(UserProfile model) { if (ModelState.IsValid) { using (var dbContext = new UsersContext()) { var user = dbContext.UserProfiles.Find(WebSecurity.GetUserId(User.Identity.Name)); if (model.Name != null) { user.Name = model.Name; } if (model.Email != null) { user.Email = model.Email; } dbContext.SaveChanges(); return RedirectToAction("Manage", "Account"); } } return View(model); }