Пример #1
0
 public void EditUser(AccountViewModel accountViewModel)
 {
     var userToEdit = GetUser(accountViewModel.UserProfile.UserId);
     if (userToEdit != null)
     {
         userToEdit.FirstName = accountViewModel.UserProfile.FirstName;
         userToEdit.LastName = accountViewModel.UserProfile.LastName;
         userToEdit.CompanyId = accountViewModel.UserProfile.CompanyId;
         _db.SaveChanges();
     }
 }
Пример #2
0
 public ActionResult Edit(AccountViewModel accountViewModel)
 {
     try
     {
         _accountHandler.EditUser(accountViewModel);
         var userRoles = accountViewModel.UserRole;
         accountViewModel = _accountHandler.GetUser(accountViewModel.UserProfile.UserId);
         foreach (var role in userRoles)
         {
             if(role.Selected)
             {
                 if (!Roles.FindUsersInRole(role.RoleName, accountViewModel.UserProfile.UserName).Contains(accountViewModel.UserProfile.UserName))
                 Roles.AddUserToRole(accountViewModel.UserProfile.UserName, role.RoleName);
             }
             else
             {
                 if (Roles.FindUsersInRole(role.RoleName, accountViewModel.UserProfile.UserName).Contains(accountViewModel.UserProfile.UserName))
                 Roles.RemoveUserFromRole(accountViewModel.UserProfile.UserName, role.RoleName);
             }
         }
         return RedirectToAction("Index");
     }
     catch
     {
         return RedirectToAction("Index");
     }
 }
Пример #3
0
 public void EditUser(AccountViewModel accountViewModel)
 {
     _accountRepository.EditUser(accountViewModel);
 }
Пример #4
0
 public void EditUser(AccountViewModel accountViewModel)
 {
     _accountManager.EditUser(accountViewModel);
 }