public ActionResult Favorites() { Account account = new Account(); var accountId = account.GetLoggedInUserId(); IEnumerable<Favorite> favorite = this.GetFavoriteCharacters(accountId); return View(favorite); }
public ActionResult Index(HelpViewModel helpViewModel) { Account account = new Account(); if (Request.IsAuthenticated) { var loggedInUserId = account.GetLoggedInUserId(); helpViewModel.EmailAddress = this.db.Accounts.Find(loggedInUserId).EmailAddress; } this.emailNotificationHelper.SendHelpAndSupportEmail(helpViewModel); return RedirectToAction("Index", "Help", null); }
public ActionResult _Preferences(Account account) { this.account = this.db.Accounts.Find(account.GetLoggedInUserId()); this.account.EmailNotification = account.EmailNotification; this.db.Entry(this.account).State = EntityState.Modified; this.db.SaveChanges(); return RedirectToAction("MyAccount"); }
public ActionResult _ChangePassword(ChangePasswordModel passwordModel) { Account account = new Account(); var loggedInUserId = this.account.GetLoggedInUserId(); account = this.db.Accounts.Find(loggedInUserId); if(this.account.ValidateUser(account.EmailAddress, passwordModel.OldPassword) == false) { ModelState.AddModelError(string.Empty, "Please enter the correct current password."); } if(ModelState.IsValid) { if(passwordModel.NewPassword == passwordModel.ConfirmPassword) { this.account = this.db.Accounts.Find(account.GetLoggedInUserId()); this.account.Password = account.GetPasswordHash(passwordModel.NewPassword); this.db.Entry(this.account).State = EntityState.Modified; this.db.SaveChanges(); } return RedirectToAction("ChangePasswordSuccess"); } else { var viewModel = new ChangePasswordModel { OldPassword = string.Empty, NewPassword = string.Empty, ConfirmPassword = string.Empty }; return View(viewModel); // return RedirectToAction("MyAccount"); } }