public ActionResult Index(PostSettingsView settings) { var user = SaveUser(settings); _authenticatedUser.SetUserInfo(user); var view = new SettingsView { User = user, Message = "User changes saved." }; ViewData["timezone"] = _hydration.GetAndSetSelectedTimezone(user.Timezone); return View(view); }
/// <summary> /// Saves the user. /// </summary> /// <param name="settings">The settings.</param> /// <returns>User.</returns> private User SaveUser(PostSettingsView settings) { User user = _authenticatedUser.GetUserInfo(); user.DisplayName = settings.DisplayName; user.Email = settings.Email; user.Password = settings.Password; user.Timezone = new Timezone {Id = settings.Timezone}; using (var tran = _session.BeginTransaction()) { _session.Update(user); tran.Commit(); } return user; }