private void LoadAllUsers() { AllUsers.Clear(); var users = _userRepository.GetAll(); AllUsers.AddRange(users); }
/// <summary> /// Initializes the state amd data of the view model instance. /// </summary> protected override void OnInitialize() { try { var userList = _userRepository.GetAllUsers(); AllUsers.Add(string.Empty);//For any user if (null != userList && userList.Any()) { var userNameList = userList.Select(u => u.Username); AllUsers.AddRange(userNameList); Username = string.Empty;//set the selected user to all. } } catch (Exception ex) { LogUtil.LogError("TransactionFilterViewModel", "OnInitialize", ex); _messagingService.ShowMessage(ErrorMessages.ERR_FAILED_TO_GET_USERS, DialogType.Error); } }