public virtual ActionResult Render(UserListModel model) { var selectedColumns = UsersPresentationHelper.GetProfileColumns().ToArray(); var orderByColumn = selectedColumns.FirstOrDefault(i => i.SupportSorting); var groupId = Request.QueryString["groupId"].Apply(parseGuid).ToNullable(); var viewModel = new UserListViewModel { AmountPerRequest = model.AmountPerRequest, DisplayedAmount = model.DisplayedAmount, Title = model.Title, MembersRows = GetUsersRowsViewModel(), OrderByColumn = orderByColumn }; var activeUserSearchRequest = new ActiveMemberSearchQuery { Text = string.Empty, Skip = 0, Take = model.DisplayedAmount, OrderingString = orderByColumn?.PropertyName, GroupId = groupId, MembersOfGroup = groupId.HasValue }; var(activeUsers, isLastRequest) = GetActiveUsers(activeUserSearchRequest); viewModel.MembersRows.SelectedColumns = UsersPresentationHelper.ExtendIfGroupMembersPage(groupId, selectedColumns); viewModel.MembersRows.Members = activeUsers; viewModel.IsLastRequest = isLastRequest; return(View(UserListViewPath, viewModel)); }
protected virtual ActiveMemberSearchQuery GetActiveMemberSearchQuery(UserListModel model) { var activeUserSearchRequest = new ActiveMemberSearchQuery { Text = string.Empty, Skip = 0, Take = model.DisplayedAmount }; return(activeUserSearchRequest); }
protected override (IEnumerable <Guid> searchResult, long totalHits) GetActiveUserIds( ActiveMemberSearchQuery query) { var searchQuery = new MemberSearchQuery { Text = query.Text, Skip = query.Skip, Take = query.Take, OrderingString = query.OrderingString, SearchableTypeIds = ((int)UintraSearchableTypeEnum.Member).ToEnumerable(), GroupId = query.GroupId, MembersOfGroup = query.MembersOfGroup }; var searchResult = _elasticIndex.Search(searchQuery); var result = searchResult.Documents.Select(r => Guid.Parse(r.Id.ToString())); return(result, searchResult.TotalHits); }
private (IEnumerable <Guid> searchResult, long totalHits) GetActiveUserIds( ActiveMemberSearchQuery query) { var skip = (query.Page - 1) * AmountPerRequest; var searchQuery = new MemberSearchQuery { Text = query.Text, Skip = skip, Take = AmountPerRequest, OrderingString = ElasticHelpers.FullName, SearchableTypeIds = ((int)UintraSearchableTypeEnum.Member).ToEnumerable(), GroupId = query.GroupId, MembersOfGroup = query.MembersOfGroup }; var searchResult = _elasticIndex.Search(searchQuery); var result = searchResult.Documents.Select(r => Guid.Parse(r.Id.ToString())); return(result, searchResult.TotalHits); }
private MembersRowsViewModel GetUsers(Guid?groupId) { var listSearch = new ActiveMemberSearchQuery { GroupId = groupId, OrderingString = string.Empty, Text = string.Empty, Page = 1, MembersOfGroup = groupId.HasValue }; var(activeUsers, isLastRequest) = GetActiveUsers(listSearch, groupId); var model = GetUsersRowsViewModel(groupId); model.SelectedColumns = UsersPresentationHelper.ExtendIfGroupMembersPage(listSearch.GroupId, UsersPresentationHelper.GetProfileColumns()); model.Members = activeUsers; model.IsLastRequest = isLastRequest; return(model); }
protected abstract (IEnumerable <Guid> searchResult, long totalHits) GetActiveUserIds(ActiveMemberSearchQuery query);
private (IEnumerable <MemberModel> result, bool isLastRequest) GetActiveUsers(ActiveMemberSearchQuery query) { var(searchResult, totalHits) = GetActiveUserIds(query); var result = searchResult .Apply(_intranetMemberService.GetMany) .Select(MapToViewModel); var isLastRequest = query.Skip + query.Take >= totalHits; return(result, isLastRequest); }
private (IEnumerable <MemberModel> result, bool isLastRequest) GetActiveUsers(ActiveMemberSearchQuery query, Guid?groupId) { var(searchResult, totalHits) = GetActiveUserIds(query); var result = _intranetMemberService.GetMany(searchResult) .Select(x => MapToViewModel(x, groupId)); var skip = (query.Page - 1) * AmountPerRequest; var isLastRequest = skip + AmountPerRequest >= totalHits; return(result, isLastRequest); }