public void Describe(DescribeSortCriterionContext describe) { foreach (var customSort in _customSortService.Query()) { var descriptor = describe.For("CustomSorts", T("Custom Sorts"), T("Manually-defined sort orders.")); var sortId = customSort.Id; var sortName = customSort.Name; var sortEditUrl = _url.Action("Edit", "CustomSortAdmin", new { id = sortId, area = "Vandelay.Industries" }); descriptor.Element( type: customSort.Name, name: new LocalizedString(customSort.Name), description: T("Custom sort order <a href=\"{1}\">{0}</a>", customSort.Name, sortEditUrl), sort: context => ApplySortCriterion(context, sortId, sortName), display: context => DisplaySortCriterion(context, sortName)); } }
public ActionResult Index(PagerParameters pagerParameters) { if (!_services.Authorizer.Authorize(Orchard.Projections.Permissions.ManageQueries, T("Not allowed to manage queries"))) { return(new HttpUnauthorizedResult()); } var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters.Page, pagerParameters.PageSize); var sorts = _sortService.Query(); var paginatedSorts = sorts.OrderBy(s => s.Name) .Skip(pager.GetStartIndex()) .Take(pager.PageSize) .ToList(); var pagerShape = Shape.Pager(pager).TotalItemCount(sorts.Count()); var vm = Shape.CustomSortAdmin_Index( CustomSorts: paginatedSorts, Pager: pagerShape ); return(new ShapeResult(this, vm)); }