private void UpdateUserModel(UserManagementViewModel indexModel, UserViewModel userModel)
        {
            var user = (from u in indexModel.UserList
                        where u.Id.Equals(userModel.Id)
                        select u).FirstOrDefault();

            if (user != null)
                UpdateUserModel(user, userModel);
        }
        private UserManagementViewModel CreateBaseUserManagementVewModel()
        {
            var model = new UserManagementViewModel();

            try
            {
                TryAddUsers(this.SecurityToken, model);
                TryAddCases(this.SecurityToken, model.NewUser);
                CheckErrors();
            }
            catch (ForbiddenException)
            {
                AddModelStateError(GlobalStrings.Forbidden);
            }
            catch (Exception)
            {
                AddModelStateError(GlobalStrings.SomethingWentWrong);
            }

            return model;
        }
 private void MapExistingUserModel(UserManagementViewModel modelWithError, UserViewModel model)
 {
     modelWithError.NewUser.FirstName = model.FirstName;
     modelWithError.NewUser.LastName = model.LastName;
     modelWithError.NewUser.Email = model.Email;
     modelWithError.NewUser.SelectedCase = model.SelectedCase;
     modelWithError.NewUser.SelectedRole = model.SelectedRole;
 }
 private void TryAddUsers(string token, UserManagementViewModel model)
 {
     model.UserList = CreateUserManagementListModel(token);
     GetUsersAssignments(model.UserList, token);
 }