public async Task <IActionResult> Index(ContentOptions options, PagerParameters pagerParameters) { if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManagePlacements)) { return(Forbid()); } var siteSettings = await _siteService.GetSiteSettingsAsync(); var pager = new Pager(pagerParameters, siteSettings.PageSize); var shapeTypes = await _placementsManager.ListShapePlacementsAsync(); var shapeList = shapeTypes.Select(entry => new ShapePlacementViewModel { ShapeType = entry.Key }).ToList(); if (!string.IsNullOrWhiteSpace(options.Search)) { shapeList = shapeList.Where(x => x.ShapeType.Contains(options.Search, StringComparison.OrdinalIgnoreCase)).ToList(); } var count = shapeList.Count(); shapeList = shapeList.OrderBy(x => x.ShapeType) .Skip(pager.GetStartIndex()) .Take(pager.PageSize).ToList(); var pagerShape = (await New.Pager(pager)).TotalItemCount(count); var model = new ListShapePlacementsViewModel { ShapePlacements = shapeList, Pager = pagerShape, Options = options, }; model.Options.ContentsBulkAction = new List <SelectListItem>() { new SelectListItem() { Text = S["Delete"], Value = nameof(ContentsBulkAction.Remove) } }; return(View("Index", model)); }
public ActionResult IndexFilterPOST(ListShapePlacementsViewModel model) { return(RedirectToAction("Index", new RouteValueDictionary { { "Options.Search", model.Options.Search } })); }