Exemplo n.º 1
0
        public static T GetGridSearchFilter <T>(this ITempDataDictionary tempData, string filterKey, GridFilterViewModel filter = null) where T : SearchFilterBaseSM
        {
            var searchFilter = tempData.GetTempData <T>(filterKey, false);

            if (searchFilter == null)
            {
                return(null);
            }

            if (searchFilter.GridFilter == null)
            {
                searchFilter.GridFilter = new GridRequestSM();
            }

            if (filter != null)
            {
                searchFilter.GridFilter.ItemsPerPage = filter.PageSize;
                var pageIndex = filter.PageIndex;
                searchFilter.GridFilter.PageNumber = pageIndex >= 0 ? pageIndex : 0;
            }

            tempData.AddTempData(filterKey, searchFilter);

            return(searchFilter);
        }
Exemplo n.º 2
0
 public static void AddGridSearchFilter <T>(this ITempDataDictionary tempData, string filterKey, T searchFilter) where T : SearchFilterBaseSM
 {
     tempData.AddTempData(filterKey, searchFilter);
 }