Пример #1
0
        public RedirectToActionResult Search(string searchTerm, bool clear = false)
        {
            //Initialize with the GET constructor (Desirializes route dictionary to use and make changes.)
            var gridBuilder = new AbsenceTypeGridBuilder(HttpContext.Session);

            if (clear)
            {
                gridBuilder.ClearSearchOptions();
            }
            else
            {
                //Set new grid values and serialize.
                gridBuilder.SetSearchOptions(searchTerm);
                gridBuilder.SerializeRoutes();
            }

            //Redirect to the List Action Method with updated grid.
            return(RedirectToAction("List", gridBuilder.CurrentGrid));
        }
Пример #2
0
        public ViewResult List(FilterGridDTO values)
        {
            var gridBuilder = new AbsenceTypeGridBuilder(HttpContext.Session, values, nameof(AbsenceType.Name));

            var options = new AbsenceTypeQueryOptions
            {
                OrderByDirection = gridBuilder.CurrentGrid.SortDirection,
            };

            options.Search(gridBuilder);

            var model = new AbsenceTypeListViewModel
            {
                Grid         = gridBuilder.CurrentGrid,
                AbsenceTypes = data.AbsenceTypes.List(options),
            };

            return(View(model));
        }