public async Task <IActionResult> Index(ContentOptions options, PagerParameters pagerParameters) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageTenantFeatureProfiles)) { return(Forbid()); } var siteSettings = await _siteService.GetSiteSettingsAsync(); var pager = new Pager(pagerParameters, siteSettings.PageSize); var featureProfilesDocument = await _featureProfilesManager.GetFeatureProfilesDocumentAsync(); var featureProfiles = featureProfilesDocument.FeatureProfiles.ToList(); if (!String.IsNullOrWhiteSpace(options.Search)) { featureProfiles = featureProfiles.Where(x => x.Key.Contains(options.Search, StringComparison.OrdinalIgnoreCase)).ToList(); } var count = featureProfiles.Count; featureProfiles = featureProfiles.OrderBy(x => x.Key) .Skip(pager.GetStartIndex()) .Take(pager.PageSize).ToList(); var pagerShape = (await New.Pager(pager)).TotalItemCount(count); var model = new FeatureProfilesIndexViewModel { FeatureProfiles = featureProfiles.Select(x => new FeatureProfileEntry { Name = x.Key, FeatureProfile = x.Value }).ToList(), Options = options, Pager = pagerShape }; model.Options.ContentsBulkAction = new List <SelectListItem>() { new SelectListItem() { Text = S["Delete"], Value = nameof(ContentsBulkAction.Remove) } }; return(View("Index", model)); }
public ActionResult IndexFilterPOST(FeatureProfilesIndexViewModel model) { return(RedirectToAction(nameof(Index), new RouteValueDictionary { { "Options.Search", model.Options.Search } })); }