public FindUsersResponse Find(FindUsersRequest request) { try { _userQuery.Init(); _userQuery.WithOnlyActivated(true); _userQuery.WithFirstName(request.FirstName); _userQuery.WithLastName(request.LastName); _userQuery.WithGender(request.GenderType.ConvertToEnum <EGenderType>()); _userQuery.WithEmail(request.Email); _userQuery.WithCellNumber(request.CellNumber); _userQuery.WithUserName(request.UserName); _userQuery.WithDevice(request.Device); _userQuery.Sort(request.Sort, request.SortBy); var totalRecords = _userQuery.TotalRecords(); _userQuery.Paginate(request.ItemsToShow, request.Page); var users = _userQuery.Execute(); return(new FindUsersResponse { Users = TypeAdapter.Adapt <List <UserResponse> >(users), TotalRecords = totalRecords }); } catch (DataAccessException) { throw new ApplicationException(); } }
public FindUsersResponse Find(FindUsersRequest request) { try { _userQuery.Init(); _userQuery.WithOnlyActivated(true); _userQuery.WithUserName(request.UserName); _userQuery.Sort(request.Sort, request.SortBy); var totalRecords = _userQuery.TotalRecords(); _userQuery.Paginate(request.ItemsToShow, request.Page); var users = _userQuery.Execute(); return(new FindUsersResponse { Users = TypeAdapter.Adapt <List <UserResponse> >(users), TotalRecords = totalRecords }); } catch (DataAccessException) { throw new ApplicationException(); } }