public IActionResult Index(SalesGridDTO id)
        {
            ViewModel view = new ViewModel(); //declares and instantiates a new copy of the class

            view.Employees = data.Employees.List(new QueryOptions <Employee> {
                OrderBy = e => e.FirstName
            });
            //filter through EmployeeID in SalesList (if EmployeeID)
            string           defaultSortField = nameof(Sales.Year);
            SalesGridBuilder sales            = new SalesGridBuilder(HttpContext.Session, id, defaultSortField);
            var options = new SalesQueryOptions
            {
                Includes         = "Employee",
                OrderByDirection = sales.CurrentRoute.SortDirection,
                PageNumber       = sales.CurrentRoute.PageNumber,
                PageSize         = sales.CurrentRoute.PageSize
            };

            options.SortFilter(sales);
            view.SalesList    = data.Sales.List(options);
            view.CurrentRoute = sales.CurrentRoute; //sets the value for CurrentRoute
            view.TotalPages   = sales.GetTotalPages(data.Sales.Count);
            //IQueryable<Sales> sales = data.Sales; //gets list
            //if (id > 0) //if statement that filters out 0, 0 will show all employees and sales. Greater then 0 will return a specific employee
            //{
            //    sales = sales.Where(p => p.EmployeeID == id); //filters
            //}
            //view.SalesList = sales.ToList();  //this gives values to SalesList
            return(View(view));
        }
        public ViewResult Index(SalesGridDTO vals)

        {
            string defaultSort = nameof(Sales.Year);
            var    builder     = new SalesGridBuilder(HttpContext.Session, vals, defaultSort);

            var options = new SalesQueryOptions
            {
                Includes   = "Employee",
                OrderBy    = builder.CurrentRoute.SortDirection,
                PageNumber = builder.CurrentRoute.PageNumber,
                PageSize   = builder.CurrentRoute.PageSize
            };

            options.SortFilter(builder);

            SalesListViewModel vs = new SalesListViewModel
            {
                Sales    = data.Sales.List(options),
                Employee = data.Employees.List(new QueryOptions <Employee> {
                    OrderBy = e => e.FirstName
                }),
                CurrentRoute = builder.CurrentRoute,
                TotalPages   = builder.GetTotalPages(data.Sales.Count)
            };

            return(View());
        }
        public ViewResult List(SalesGridDTO values)
        {
            var builder = new SalesGridBuilder(HttpContext.Session, values, defaultSortField: nameof(Sales.Year));

            var options = new QueryOptions <Sales>
            {
                Includes         = "Employee.FullName, Year, Quarter, SalesAmount",
                OrderByDirection = builder.CurrentRoute.SortDirection,
                PageNumber       = builder.CurrentRoute.PageNumber,
                PageSize         = builder.CurrentRoute.PageSize
            };
            var vm = new ViewModel
            {
                SalesList = Data.Sales.List(options),
                Employees = Data.Employees.List(new QueryOptions <Employee>
                {
                    OrderBy = a => a.FirstName
                }),
                CurrentRoute = builder.CurrentRoute,
                TotalPages   = builder.GetTotalPages(Data.Sales.Count)
            };

            return(View(vm));
        }