예제 #1
0
        /// <inheritdoc />
        public override ContentListViewModel CreateListViewModel(ITaxon taxonFilter, int page)
        {
            if (page < 1)
            {
                throw new ArgumentException("'page' argument has to be at least 1.", "page");
            }

            var query = this.GetItemsQuery();

            if (query == null)
            {
                return(this.CreateListViewModelInstance());
            }

            var viewModel = this.CreateListViewModelInstance();

            this.PopulateListViewModel(page, query, viewModel);

            foreach (var listModel in viewModel.Items.Cast <ListViewModel>())
            {
                var listItemModel = new ListItemModel(listModel)
                {
                    SortExpression              = this.SortExpression,
                    FilterExpression            = this.FilterExpression,
                    SerializedAdditionalFilters = this.SerializedAdditionalFilters,
                    // We need only filter list items.
                    SelectionMode = SelectionMode.FilteredItems,
                    ProviderName  = this.ProviderName
                };

                listModel.ListItemViewModel = listItemModel.CreateListViewModel(taxonFilter, page);
            }

            return(viewModel);
        }
예제 #2
0
        /// <inheritdoc />
        public override ContentDetailsViewModel CreateDetailsViewModel(IDataItem item)
        {
            var viewModel = base.CreateDetailsViewModel(item);

            var listItemModel = new ListItemModel((ListViewModel)viewModel.Item);

            ((ListViewModel)viewModel.Item).ListItemViewModel = listItemModel.CreateListViewModel(null, 1);

            return(viewModel);
        }