public virtual ActionResult Selectable(string categoryFolder, int?page, int?pageSize, string orderField = null, string direction = null) { var textFolder = (TextFolder)(FolderHelper.Parse <TextFolder>(Repository, categoryFolder).AsActual()); Schema schema = new Schema(Repository, textFolder.SchemaName).AsActual(); SchemaPath schemaPath = new SchemaPath(schema); ViewData["Folder"] = textFolder; ViewData["Schema"] = schema; ViewData["Template"] = textFolder.GetFormTemplate(FormType.Selectable); IContentQuery <TextContent> query = textFolder.CreateQuery(); if (string.IsNullOrEmpty(orderField)) { query = query.DefaultOrder(); } else { if (!string.IsNullOrEmpty(direction) && direction.ToLower() == "asc") { query = query.OrderBy(orderField); } else { query = query.OrderByDescending(orderField); } } return(View(query.ToPageList(page ?? 1, pageSize ?? textFolder.PageSize))); }