public ActionResult MyAccount(ManagerUpdateListViewModel managerUpdateListViewModel) { var locker = Security.Security.CreatLocker(); if (ModelState.IsValid) { string encryptKey = locker.Encrypt(managerUpdateListViewModel.Person.Password); managerUpdateListViewModel.Person.Password = encryptKey; _personService.Update(managerUpdateListViewModel.Person); _managerService.Update(managerUpdateListViewModel.Manager); _logger.LogInformation("{firstname} {lastname} updated his personal information.", managerUpdateListViewModel.Person.FirstName, managerUpdateListViewModel.Person.LastName); } managerUpdateListViewModel.Groups = _groupService.GetList(); return(View(managerUpdateListViewModel)); }
public ActionResult MyAccount() { var personId = HttpContext.Session.GetInt32("personId"); var locker = Security.Security.CreatLocker(); var model = new ManagerUpdateListViewModel { Person = _personService.GetById((int)personId), //personId Manager = _managerService.GetById((int)personId), //personId Groups = _groupService.GetList() }; string decryptKey = locker.Decrypt(model.Person.Password); model.Person.Password = decryptKey; return(View(model)); }