public async Task <IActionResult> Index(int page = 1) { var filter = new BaseFilter(page); var roleList = await _roleService.GetPaginatedListAsync(filter); PaginateViewModel paginateModel = new PaginateViewModel { ItemCount = roleList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new RoleListViewModel { Roles = roleList.Data, PaginateModel = paginateModel }; return(View(viewModel)); }
public async Task <IActionResult> AuthorizationCodes(int page = 1) { var filter = new BaseFilter(page); var authorizationCodeList = await _authorizationCodeService.GetPaginatedListAsync(filter); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = authorizationCodeList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.PastMaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new AuthorizationCodeListViewModel { AuthorizationCodes = authorizationCodeList.Data, PaginateModel = paginateModel, RoleList = new SelectList(await _roleService.GetAllAsync(), "Id", "Name") }; return(View(viewModel)); }
public async Task <IActionResult> Branches(string search, int page = 1) { var filter = new BaseFilter(page) { Search = search }; var branchList = await _siteService.GetPaginatedBranchListAsync(filter); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = branchList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } BranchesListViewModel viewModel = new BranchesListViewModel() { Branches = branchList.Data.ToList(), PaginateModel = paginateModel, SystemList = new SelectList(await _siteService.GetSystemList(), "Id", "Name") }; return(View(viewModel)); }
public async Task <IActionResult> PointTranslations(int page = 1) { var filter = new BaseFilter(page); var translationsList = await _pointTranslationService.GetPaginatedListAsync(filter); var paginateModel = new PaginateViewModel { ItemCount = translationsList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new PointTranslationsListViewModel { PointTranslations = translationsList.Data, PaginateModel = paginateModel }; PageTitle = "Point Translation management"; return(View(viewModel)); }
public async Task <IActionResult> Index(string search, int page = 1) { var filter = new BaseFilter(page) { Search = search }; var systemList = await _siteService.GetPaginatedSystemListAsync(filter); var paginateModel = new PaginateViewModel { ItemCount = systemList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.PastMaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new SystemListViewModel { Systems = systemList.Data.ToList(), PaginateModel = paginateModel, }; return(View(viewModel)); }
public async Task <IActionResult> Index(int page = 1) { BaseFilter filter = new BaseFilter(page); var questionnaireList = await _questionnaireService.GetPaginatedListAsync(filter); PaginateViewModel paginateModel = new PaginateViewModel { ItemCount = questionnaireList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.PastMaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } QuestionnairesListViewModel viewModel = new QuestionnairesListViewModel { Questionnaires = questionnaireList.Data, PaginateModel = paginateModel }; return(View(viewModel)); }
public async Task <IActionResult> Locations(int page = 1) { BaseFilter filter = new BaseFilter(page); var locationList = await _eventService.GetPaginatedLocationsListAsync(filter); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = locationList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } LocationsListViewModel viewModel = new LocationsListViewModel() { Locations = locationList.Data, PaginateModel = paginateModel, }; return(View(viewModel)); }
public async Task <IActionResult> Criteria(int page = 1) { PageTitle = "Drawing Criteria"; int take = 15; int skip = take * (page - 1); var criterionList = await _drawingService.GetPaginatedCriterionListAsync(skip, take); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = criterionList.Count, CurrentPage = page, ItemsPerPage = take }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } CriterionListViewModel viewModel = new CriterionListViewModel() { Criteria = criterionList.Data, PaginateModel = paginateModel }; return(View(viewModel)); }
public async Task <IActionResult> Index(int page = 1, bool archived = false) { var filter = new BaseFilter(page) { IsActive = !archived }; var carousels = await _carouselService.GetPaginatedListAsync(filter); var paginateModel = new PaginateViewModel { ItemCount = carousels.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.PastMaxPage) { return(RedirectToRoute(new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new ListViewModel { Carousels = carousels.Data, PaginateModel = paginateModel }; return(View(viewModel)); }
public async Task <IActionResult> Categories(int page = 1) { var filter = new BaseFilter(page); var categoryList = await _newsService.GetPaginatedCategoryListAsync(filter); var paginateModel = new PaginateViewModel { ItemCount = categoryList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.PastMaxPage) { return(RedirectToRoute(new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new CategoryListViewModel { Categories = categoryList.Data, PaginateModel = paginateModel, }; return(View(viewModel)); }
public async Task <IActionResult> ViewAll(int page = 1) { const int take = 15; int skip = take * (page - 1); var mailList = await _mailService.GetAllPaginatedAsync(skip, take); var paginateModel = new PaginateViewModel { ItemCount = mailList.Count, CurrentPage = page, ItemsPerPage = take }; if (paginateModel.PastMaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new MailListViewModel { Mail = mailList.Data, PaginateModel = paginateModel, CanDelete = UserHasPermission(Permission.DeleteAnyMail) }; return(View(viewModel)); }
public async Task <IActionResult> Index(int page = 1) { int take = 15; int skip = take * (page - 1); var pageList = await _pageService.GetPaginatedPageListAsync(skip, take); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = pageList.Count, CurrentPage = page, ItemsPerPage = take }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } PagesListViewModel viewModel = new PagesListViewModel() { Pages = pageList.Data.ToList(), PaginateModel = paginateModel, CanAddPage = UserHasPermission(Permission.AddPages), CanDeletePage = UserHasPermission(Permission.DeletePages) }; return(View(viewModel)); }
public async Task <IActionResult> Broadcasts(bool upcoming = true, int page = 1) { var filter = new BroadcastFilter(page) { Upcoming = upcoming }; var broadcastList = await _mailService.PageBroadcastsAsync(filter); var paginateModel = new PaginateViewModel { ItemCount = broadcastList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.PastMaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new BroadcastListViewModel { Broadcasts = broadcastList.Data, PaginateModel = paginateModel, Upcoming = upcoming }; return(View(viewModel)); }
public async Task <IActionResult> Index(int page = 1) { int take = 15; int skip = take * (page - 1); var schoolList = await _schoolService.GetPaginatedListAsync(skip, take); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = schoolList.Count, CurrentPage = page, ItemsPerPage = take }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } SchoolsListViewModel viewModel = new SchoolsListViewModel() { Schools = schoolList.Data.ToList(), PaginateModel = paginateModel, SchoolDistricts = new SelectList(await _schoolService.GetDistrictsAsync(), "Id", "Name"), SchoolTypes = new SelectList(await _schoolService.GetTypesAsync(), "Id", "Name") }; return(View(viewModel)); }
public async Task <IActionResult> Types(int page = 1) { PageTitle = "School Types"; int take = 15; int skip = take * (page - 1); var typeList = await _schoolService.GetPaginatedTypeListAsync(skip, take); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = typeList.Count, CurrentPage = page, ItemsPerPage = take }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } TypeListViewModel viewModel = new TypeListViewModel() { SchoolTypes = typeList.Data.ToList(), PaginateModel = paginateModel, }; return(View(viewModel)); }
public async Task <IActionResult> Index(int page = 1) { int take = 15; int skip = take * (page - 1); var mailList = await _mailService.GetUserInboxPaginatedAsync(skip, take); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = mailList.Count, CurrentPage = page, ItemsPerPage = take }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } MailListViewModel viewModel = new MailListViewModel() { Mail = mailList.Data, PaginateModel = paginateModel }; return(View(viewModel)); }
public async Task <IActionResult> GetChallengeGroupList(string challengeGroupIds, string search, int page = 1) { var filter = new ChallengeGroupFilter(page, 10) { ActiveGroups = true, Search = search }; if (!string.IsNullOrWhiteSpace(challengeGroupIds)) { filter.ChallengeGroupIds = challengeGroupIds.Split(',') .Where(_ => !string.IsNullOrWhiteSpace(_)) .Select(int.Parse) .ToList(); } var challengeGroupList = await _challengeService.GetPaginatedGroupListAsync(filter); var paginateModel = new PaginateViewModel { ItemCount = challengeGroupList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; var viewModel = new ChallengeGroupsListViewModel { ChallengeGroups = challengeGroupList.Data, PaginateModel = paginateModel, CanEditGroups = UserHasPermission(Permission.EditChallengeGroups), }; return(PartialView("_ChallengeGroupListPartial", viewModel)); }
public async Task <IActionResult> Index(int page = 1) { Domain.Model.Filter filter = new Domain.Model.Filter(page); var eventList = await _eventService.GetPaginatedListAsync(filter, true); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = eventList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } EventsListViewModel viewModel = new EventsListViewModel() { Events = eventList.Data, PaginateModel = paginateModel, CanManageLocations = UserHasPermission(Permission.ManageLocations) }; return(View(viewModel)); }
public async Task <IActionResult> Bundles(bool unlockable = true, int page = 1) { var filter = new AvatarFilter(page) { Unlockable = unlockable }; var bundleList = await _avatarService.GetPaginatedBundleListAsync(filter); var paginateModel = new PaginateViewModel() { ItemCount = bundleList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new BundlesListViewModel() { Bundles = bundleList.Data, PaginateModel = paginateModel, Unlockable = unlockable }; PageTitle = "Avatar Bundles"; return(View(viewModel)); }
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 })); }
public async Task <IActionResult> Index(int page = 1) { var filter = new BaseFilter(page); var headerList = await _pageService.GetPaginatedHeaderListAsync(filter); var paginateModel = new PaginateViewModel { ItemCount = headerList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.PastMaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new PagesListViewModel { PageHeaders = headerList.Data.ToList(), PaginateModel = paginateModel }; return(View(viewModel)); }
public async Task <IActionResult> Index(int page = 1) { var filter = new BaseFilter(page); var siteList = await _siteService.GetPaginatedListAsync(filter); if (siteList.Count == 1) { return(RedirectToAction("Detail", new { id = siteList.Data.First().Id })); } var paginateModel = new PaginateViewModel { ItemCount = siteList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.PastMaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new SiteListViewModel() { Sites = siteList.Data, PaginateModel = paginateModel }; return(View(viewModel)); }
public async Task <IActionResult> Index(string search, int page = 1) { var filter = new BaseFilter(page) { Search = search }; var schoolList = await _schoolService.GetPaginatedListAsync(filter); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = schoolList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } SchoolsListViewModel viewModel = new SchoolsListViewModel() { Schools = schoolList.Data.ToList(), PaginateModel = paginateModel, DistrictList = await _schoolService.GetDistrictsAsync(), SchoolTypes = new SelectList(await _schoolService.GetTypesAsync(), "Id", "Name") }; return(View(viewModel)); }
public async Task <IActionResult> Types(string search, int page = 1) { PageTitle = "School Types"; var filter = new BaseFilter(page) { Search = search }; var typeList = await _schoolService.GetPaginatedTypeListAsync(filter); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = typeList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } TypeListViewModel viewModel = new TypeListViewModel() { SchoolTypes = typeList.Data.ToList(), PaginateModel = paginateModel, }; return(View(viewModel)); }
public async Task <IActionResult> Index(string search, int page = 1) { var filter = new BaseFilter(page) { Search = search }; var categoryList = await _categoryService.GetPaginatedListAsync(filter); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = categoryList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new CategoryListViewModel() { Categories = categoryList.Data, PaginateModel = paginateModel }; return(View(viewModel)); }
public async Task <IActionResult> Districts(string search, int page = 1) { PageTitle = "School Districts"; var filter = new BaseFilter(page) { Search = search }; var districtList = await _schoolService.GetPaginatedDistrictListAsync(filter); var paginateModel = new PaginateViewModel { ItemCount = districtList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.PastMaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var viewModel = new DistrictListViewModel { SchoolDistricts = districtList.Data.ToList(), PaginateModel = paginateModel }; return(View(viewModel)); }
public async Task <IActionResult> History(int page = 1) { int take = 15; int skip = take * (page - 1); var history = await _userService .GetPaginatedUserHistoryAsync(GetActiveUserId(), skip, take); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = history.Count, CurrentPage = page, ItemsPerPage = take }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } User user = await _userService.GetDetails(GetActiveUserId()); HistoryListViewModel viewModel = new HistoryListViewModel() { Historys = new List <HistoryItemViewModel>(), PaginateModel = paginateModel, HouseholdCount = await _userService .FamilyMemberCountAsync(user.HouseholdHeadUserId ?? user.Id), HasAccount = !string.IsNullOrWhiteSpace(user.Username), TotalPoints = user.PointsEarned }; foreach (var item in history.Data) { if (item.ChallengeId != null) { var url = Url.Action("Detail", "Challenges", new { id = item.ChallengeId }); item.Description = $"<a target='_blank' href='{url}'>{item.Description}</a>"; } HistoryItemViewModel itemModel = new HistoryItemViewModel() { CreatedAt = item.CreatedAt.ToString("d"), Description = item.Description, PointsEarned = item.PointsEarned, }; if (!string.IsNullOrWhiteSpace(item.BadgeFilename)) { itemModel.BadgeFilename = _pathResolver.ResolveContentPath(item.BadgeFilename); } viewModel.Historys.Add(itemModel); } return(View(viewModel)); }
public async Task <IActionResult> Programs(int page = 1, int?ageGroup = null) { var settings = await _performerSchedulingService.GetSettingsAsync(); var schedulingStage = _performerSchedulingService.GetSchedulingStage(settings); if (schedulingStage < PsSchedulingStage.SchedulingPreview) { return(RedirectToAction(nameof(Index))); } var filter = new PerformerSchedulingFilter(page, ProgramsPerPage) { AgeGroupId = ageGroup, IsApproved = true }; var programList = await _performerSchedulingService.GetPaginatedProgramListAsync(filter); var paginateModel = new PaginateViewModel { ItemCount = programList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.PastMaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } var systemId = GetId(ClaimType.SystemId); foreach (var program in programList.Data) { program.AvailableInSystem = await _performerSchedulingService .GetPerformerSystemAvailabilityAsync(program.PerformerId, systemId); } var viewModel = new ProgramListViewModel { Programs = programList.Data, PaginateModel = paginateModel, AgeGroups = await _performerSchedulingService.GetAgeGroupsAsync(), AgeGroupId = ageGroup }; return(View(viewModel)); }
public async Task <IActionResult> Household(int page = 1) { int take = 15; int skip = take * (page - 1); var authUser = await _userService.GetDetails(GetId(ClaimType.UserId)); User activeUser = await _userService.GetDetails(GetActiveUserId()); User headUser = null; if (authUser.HouseholdHeadUserId != null) { headUser = await _userService.GetDetails((int)authUser.HouseholdHeadUserId); } var household = await _userService .GetPaginatedFamilyListAsync(authUser.HouseholdHeadUserId ?? authUser.Id, skip, take); // authUser is the head of the family bool authUserIsHead = authUser.Id == household.Data.FirstOrDefault()?.HouseholdHeadUserId; PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = household.Count, CurrentPage = page, ItemsPerPage = take }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } HouseholdListViewModel viewModel = new HouseholdListViewModel() { Users = household.Data, PaginateModel = paginateModel, HouseholdCount = household.Count, HasAccount = !string.IsNullOrWhiteSpace(activeUser.Username), Head = headUser ?? authUser, AuthUserIsHead = authUserIsHead, ActiveUser = GetActiveUserId() }; return(View(viewModel)); }
public async Task <IActionResult> Layer(int id, string search, bool?unlockable = null, int page = 1) { var filter = new AvatarFilter(page, 12) { LayerId = id, Search = search, Unlockable = unlockable }; var itemList = await _avatarService.PageItemsAsync(filter); PaginateViewModel paginateModel = new PaginateViewModel() { ItemCount = itemList.Count, CurrentPage = page, ItemsPerPage = filter.Take.Value }; if (paginateModel.MaxPage > 0 && paginateModel.CurrentPage > paginateModel.MaxPage) { return(RedirectToRoute( new { page = paginateModel.LastPage ?? 1 })); } foreach (var item in itemList.Data) { item.Thumbnail = _pathResolver.ResolveContentPath(item.Thumbnail); } if (itemList.Data.Any()) { PageTitle = $"Avatar Items: {itemList.Data.First().AvatarLayerName}"; } var viewModel = new ItemsListViewModel() { Items = itemList.Data, PaginateModel = paginateModel, Id = id, Search = search, Unlockable = unlockable }; return(View(viewModel)); }