public ActionResult MyAccount(UserUpdateListViewModel userUpdateListViewModel) { var locker = Security.Security.CreatLocker(); if (ModelState.IsValid) { string encryptKey = locker.Encrypt(userUpdateListViewModel.Person.Password); userUpdateListViewModel.Person.Password = encryptKey; _personService.Update(userUpdateListViewModel.Person); _userService.Update(userUpdateListViewModel.User); _logger.LogInformation("{firstname} {lastname} updated his personal information.", userUpdateListViewModel.Person.FirstName, userUpdateListViewModel.Person.LastName); } userUpdateListViewModel.Cities = _cityService.GetList(); userUpdateListViewModel.Genders = _genderService.GetList(); return(View(userUpdateListViewModel)); }
public ActionResult MyAccount() { var personId = HttpContext.Session.GetInt32("personId"); var locker = Security.Security.CreatLocker(); var model = new UserUpdateListViewModel { Person = _personService.GetById((int)personId), //personId !! User = _userService.GetById((int)personId), //personId !! Genders = _genderService.GetList(), Cities = _cityService.GetList() }; string decryptKey = locker.Decrypt(model.Person.Password); model.Person.Password = decryptKey; return(View(model)); }