Beispiel #1
0
        public void Map(LatestActivitiesPanelModel node, LatestActivitiesPanelViewModel viewModel)
        {
            var centralFeedType = _feedTypeProvider[node.ActivityType.Value.Id];

            var allItems      = _centralFeedHelper.GetCentralFeedItems(centralFeedType).ToList();
            var filteredItems = FilterLatestActivities(allItems).Take(node.CountToDisplay.Value);
            var sortedItems   = _centralFeedHelper.Sort(filteredItems, centralFeedType).Select(Convert).ToList();

            viewModel.Feed             = sortedItems;
            viewModel.ShowSeeAllButton = sortedItems.Count < allItems.Count;
        }
        public FeedListViewModel FeedList(FeedListModel model)
        {
            var centralFeedType = _feedTypeProvider[model.TypeId];

            var items = model.GroupId.HasValue ? _centralFeedHelper.GetGroupFeedItems(centralFeedType, model.GroupId.Value).ToList() :
                        _centralFeedHelper.GetCentralFeedItems(centralFeedType).ToList();

            if (!items.Any())
            {
                return(new FeedListViewModel());
            }

            var tabSettings = GetTabSettings(model.GroupId.HasValue, centralFeedType);

            var filteredItems = _feedFilterService.ApplyFilters(items, model.FilterState, tabSettings).ToList();

            var centralFeedModel = GetFeedListModel(model, filteredItems, centralFeedType);

            return(centralFeedModel);
        }