public async Task <IActionResult> SearchList(int?page)
        {
            int pageSize   = 3;
            int pageNumber = (page ?? 1);

            return(View(PaginatedList <Tube> .CreateNonAsync(await GetSearchingResult(),
                                                             pageNumber,
                                                             pageSize)));
        }
        public async Task <IActionResult> IndexType(string type, int?page)
        {
            ICollection <Tube> tubesInCategory = await tubes.FindAllAsync(x => x.Type == type);

            int pageSize   = 6;
            int pageNumber = (page ?? 1);

            return(View(PaginatedList <Tube> .CreateNonAsync(tubesInCategory,
                                                             pageNumber,
                                                             pageSize)));
        }
        public async Task <ActionResult> Index(int?page)
        {
            var roughList = await categories.GetAllAsync();

            var topCategories = roughList.Where(x => x.ParentId == null).ToList();
            var completeList  = GetRecursively(roughList, topCategories);

            int pageSize   = 15;
            int pageNumber = (page ?? 1);

            return(View(PaginatedList <Category> .CreateNonAsync(completeList,
                                                                 pageNumber,
                                                                 pageSize)));
        }
Пример #4
0
        public IActionResult Favorites(string sortOrder, string currentFilter,
                                       string searchString,
                                       int?page)
        {
            int pageSize          = 10;
            var favoriteCountries = GetAllFavorites();
            List <CountryViewModel> paginatedCountryDataList = new List <CountryViewModel>();
            var paginatedCountryList = PaginatedList <Country> .CreateNonAsync(favoriteCountries, page ?? 1, pageSize);

            Parallel.ForEach((List <Country>)paginatedCountryList, (country) =>
            {
                paginatedCountryDataList.Add(CountryMaker.PopulateFullCountryData(country, true));
            });
            return(View(new PaginatedList <CountryViewModel>(paginatedCountryDataList, favoriteCountries.Count(), page ?? 1, pageSize)));
        }
Пример #5
0
        public async Task OnGetAsync(int?pageIndex)
        {
            //This page will have pagination, but not sort, and not filter

            IQueryable <ProductCategory> productCategoryIQ = from pc in _context.ProductCategory
                                                             .Include(p => p.Product)
                                                             .ThenInclude(o => o.Offering)
                                                             .ThenInclude(ao => ao.ArchivedOffering)
                                                             select pc;

            calculatedInflations = new List <CalculatedInflation>();

            foreach (var pc in productCategoryIQ)
            {
                List <ArchivedOffering> archivesInCategory = pc.Product.SelectMany(o => o.Offering.SelectMany(ao => ao
                                                                                                              .ArchivedOffering.Where(aoVal => aoVal.Price.HasValue).Where(aoDate => aoDate.Date != null))).ToList();

                if (archivesInCategory.Count != 0)
                {
                    DateTime oldestDate = archivesInCategory.Min(aoDate => aoDate.Date);
                    int      length     = DateTime.Now.Year - oldestDate.Year + 1;
                    for (int i = 0; i < length; i++)
                    {
                        CalculatedInflation calculatedInflation = MakeCalculatedInflation(archivesInCategory, pc.Name, i);
                        calculatedInflations.Add(calculatedInflation);
                    }
                }
            }
            calculatedInflations = calculatedInflations.OrderBy(c => c.InflationName)
                                   .ThenByDescending(date => date.FiscalYear).ToList();

            int pageSize = 12;

            CalculatedInflation = PaginatedList <CalculatedInflation> .CreateNonAsync(calculatedInflations, pageIndex ?? 1, pageSize);


            //***********************Authorization***********************************************************************

            Product productForAuth = new Product();
            var     isAuthorized   = await AuthorizationService.AuthorizeAsync(User, productForAuth, Operations.Read);

            if (!isAuthorized.Succeeded)
            {
                new ChallengeResult();
            }
            //**********************************************************************************************************
        }
        public async Task <IActionResult> IndexCategory(string category, int?page, int?categoryId)
        {
            ICollection <Tube> tubesInCategory;

            if (categoryId != null)
            {
                tubesInCategory = await tubes.FindAllAsync(x => x.Category.CategoryId == categoryId);
            }
            else
            {
                tubesInCategory = await tubes.FindAllAsync(x => x.Category.CategoryName == category);
            }

            int pageSize   = 6;
            int pageNumber = (page ?? 1);

            return(View(PaginatedList <Tube> .CreateNonAsync(tubesInCategory,
                                                             pageNumber,
                                                             pageSize)));
        }