Пример #1
0
        /// <summary>
        /// Gets search grid.
        /// </summary>
        /// <param name="tenantId">Identifies website that master pages belong to.</param>
        /// <param name="page">1-based page index (null if not specified).</param>
        /// <param name="search">Search terms.</param>
        /// <returns>Grid view model.</returns>
        public Grid GetSearchGrid(long tenantId, int?page, string search)
        {
            // Get layouts that match search parameters
            ISearchParameters searchParameters = new SearchParameters {
                PageIndex = (page ?? 1) - 1, PageSize = 10, Search = search
            };
            ISearchResult <MasterPage> searchResult = _masterPageService.Search(tenantId, searchParameters);

            // Construct grid
            List <string> properties = new List <string> {
                "Name"
            };
            UrlParameters urlParameters = new UrlParameters {
                ControllerName = "masterpages", ActionName = "read"
            };
            List <RoutePropertyPair> routePropertyPairs = new List <RoutePropertyPair> {
                new RoutePropertyPair {
                    PropertyName = MasterPagePropertyNames.Id, RouteValueName = MasterPagePropertyNames.Id
                }
            };

            return(_gridService.GetGrid <MasterPage>(searchParameters, searchResult, properties, urlParameters, routePropertyPairs, MasterPageResource.NoMasterPagesMessage));
        }