public IEnumerable <ProviderUser> Search(ProviderUserSearchParameters searchParameters)
        {
            var sql = ProviderUserSelect;
            var and = "";

            if (!string.IsNullOrEmpty(searchParameters.Username))
            {
                sql += "Username LIKE '%' + @Username + '%' ";
                and  = "AND ";
            }
            if (!string.IsNullOrEmpty(searchParameters.Name))
            {
                sql += and + "pu.Fullname LIKE '%' + @Name + '%' ";
                and  = "AND ";
            }
            if (!string.IsNullOrEmpty(searchParameters.Email))
            {
                sql += and + "Email LIKE '%' + @Email + '%' ";
                and  = "AND ";
            }
            if (searchParameters.AllUnverifiedEmails)
            {
                sql += and + "(EmailVerificationCode IS NOT NULL OR ProviderUserStatusId != 20) ";
            }
            sql += "ORDER BY FullName";

            var providerUsers = _getOpenConnection
                                .Query <Entities.ProviderUser>(sql, searchParameters)
                                .Select(MapProviderUser);

            return(providerUsers);
        }
        public ProviderUserSearchResultsViewModel SearchProviderUsers(ProviderUserSearchViewModel searchViewModel)
        {
            var searchParameters = new ProviderUserSearchParameters
            {
                Username            = searchViewModel.Username,
                Name                = searchViewModel.Name,
                Email               = searchViewModel.Email,
                AllUnverifiedEmails = searchViewModel.AllUnverifiedEmails
            };

            var providerUsers = _userProfileService.SearchProviderUsers(searchParameters);

            var viewModel = new ProviderUserSearchResultsViewModel
            {
                SearchViewModel = searchViewModel,
                ProviderUsers   = providerUsers.Select(Convert).ToList()
            };

            return(viewModel);
        }
 public IEnumerable <ProviderUser> SearchProviderUsers(ProviderUserSearchParameters searchParameters)
 {
     return(_providerUserReadRepository.Search(searchParameters));
 }