Example #1
0
        public ActionResult Index(int taxonomyId, PagerParameters pagerParameters)
        {
            var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);

            var taxonomy = _taxonomyService.GetTaxonomy(taxonomyId);

            var allTerms = TermPart.Sort(_taxonomyService.GetTermsQuery(taxonomyId).List());

            var termsPage = pager.PageSize > 0 ? allTerms.Skip(pager.GetStartIndex()).Take(pager.PageSize) : allTerms;

            var pagerShape = Shape.Pager(pager).TotalItemCount(allTerms.Count());

            var entries = termsPage
                          .Select(term => term.CreateTermEntry())
                          .ToList();

            var model = new TermAdminIndexViewModel {
                Terms      = entries,
                Taxonomy   = taxonomy,
                TaxonomyId = taxonomyId,
                Pager      = pagerShape
            };

            return(View(model));
        }
        public IEnumerable <TermPart> GetAllTerms()
        {
            var result = _contentManager
                         .Query <TermPart, TermPartRecord>()
                         .List();

            return(TermPart.Sort(result));
        }
        public IEnumerable <TermPart> GetTerms(int taxonomyId)
        {
            var result = _contentManager.Query <TermPart, TermPartRecord>()
                         .Where(x => x.TaxonomyId == taxonomyId)
                         .List();

            return(TermPart.Sort(result));
        }
Example #4
0
        new public IEnumerable <TermPart> GetAllTerms()
        {
            var result = _contentManager
                         .Query <TermPart, TermPartRecord>().ForVersion(VersionOptions.Latest)
                         .List();

            return(TermPart.Sort(result));
        }
        public IEnumerable <TermPart> GetAllTerms()
        {
            var result = _contentManager
                         .Query <TermPart, TermPartRecord>()
                         .WithQueryHints(new QueryHints().ExpandRecords <AutoroutePartRecord, TitlePartRecord, CommonPartRecord>())
                         .List();

            return(TermPart.Sort(result));
        }
        public IEnumerable <TermPart> GetChildren(TermPart term)
        {
            var rootPath = term.FullPath + "/";

            var result = _contentManager.Query <TermPart, TermPartRecord>()
                         .WithQueryHints(new QueryHints().ExpandRecords <AutoroutePartRecord, TitlePartRecord, CommonPartRecord>())
                         .Where(x => x.Path.StartsWith(rootPath))
                         .List();

            return(TermPart.Sort(result));
        }
        public IEnumerable <TermPart> GetChildren(TermPart term, bool includeParent)
        {
            var rootPath = term.FullPath + "/";

            var result = _contentManager.Query <TermPart, TermPartRecord>()
                         .Where(x => x.Path.StartsWith(rootPath))
                         .List();

            if (includeParent)
            {
                result = result.Concat(new [] { term });
            }

            return(TermPart.Sort(result));
        }