Exemple #1
0
        public async Task <IActionResult> Index(int page = 1)
        {
            int skip = PaginationTake * (page - 1);
            var data = await _groupTypesService.GetAllMCPagedAsync(skip, PaginationTake);

            var paginateModel = new PaginateViewModel
            {
                ItemCount    = data.Count,
                CurrentPage  = page,
                ItemsPerPage = PaginationTake
            };

            if (paginateModel.PastMaxPage)
            {
                return(RedirectToRoute(
                           new
                {
                    page = paginateModel.LastPage ?? 1
                }));
            }

            var(useGroups, maximumHousehold) =
                await GetSiteSettingIntAsync(SiteSettingKey.Users.MaximumHouseholdSizeBeforeGroup);


            return(View(new GroupTypesListViewModel
            {
                SiteId = GetCurrentSiteId(),
                GroupTypes = data.Data,
                PaginateModel = paginateModel,
                MaximumHouseholdMembers = useGroups ? (int?)maximumHousehold : null
            }));
        }