Esempio n. 1
0
        // GET: AirFilter
        public async Task <ActionResult> Index(int?carID, string sortOrder)
        {
            var fuelQueryable = from s in db.Fuel.Include(a => a.Car)
                                select s;

            if (carID != null && carID > 0)
            {
                fuelQueryable = fuelQueryable.Where(d => d.CarID == carID);
                ViewBag.CarID = carID;
                UpdateCarDescription(carID);
            }

            var sortDirection = ControllerHelper.GetSortOrder(sortOrder);

            UpdateSortDirection(sortDirection);
            fuelQueryable = FuelManager.AddSortToQuery(fuelQueryable, sortOrder);

            return(View(await fuelQueryable.ToListAsync()));
        }