Ejemplo n.º 1
0
        public async Task <ActionResult> GetSortedList(IList <GlobalPlantList> GlobalPlantList, bool Desc, int?pageIndex)
        {
            IQueryable <GlobalPlantList> pagedList = from s in _context.GlobalPlantLists
                                                     select s;
            PaginatedList <GlobalPlantList> PaginatedList;
            int pageSize = 25;

            PaginatedList = await PaginatedList <GlobalPlantList> .CreateAsync(
                pagedList.AsNoTracking(), pageIndex ?? 1, pageSize);

            // globalPlantList = PaginatedList.ToList();
            // var GlobalPlantList = paginatedList.OrderByDescending(e => e.Name);
            if (Desc == true)
            {
                globalPlantList = PaginatedList.OrderBy(e => e.Name).ToList();
                Desc            = false;
                this.Desc       = Desc;
            }
            else
            {
                this.Desc       = Desc;
                globalPlantList = PaginatedList.OrderByDescending(e => e.Name).ToList();
                Desc            = true;
            }
            // return View(globalPlantList);

            return(RedirectToPage("/GlobalPlants/Index", "NameOrder", new RouteValueDictionary(new { globalPlantList, Desc, pageIndex }))); //RedirectToPage("/GlobalPlants/Index", globalPlantList);
            // RedirectToPageResult l = RedirectToPage("/GlobalPlants/Index", "GetOrder" );
            //return l;
        }