public async Task<IActionResult> Index( Guid? siteId, int pageNumber = 1, int pageSize = -1 ) { var selectedSite = await siteManager.GetSiteForDataOperations(siteId); // only server admin site can edit other sites settings if (selectedSite.Id != siteManager.CurrentSite.Id) { ViewData["Title"] = string.Format(CultureInfo.CurrentUICulture, sr["{0} - API Resource Management"], selectedSite.SiteName); } else { ViewData["Title"] = sr["API Resource Management"]; } int itemsPerPage = 10; if (pageSize > 0) { itemsPerPage = pageSize; } var model = new ApiListViewModel(); model.SiteId = selectedSite.Id.ToString(); var result = await apiManager.GetApiResources(selectedSite.Id.ToString(), pageNumber, itemsPerPage); model.Apis = result.Data; model.Paging.CurrentPage = pageNumber; model.Paging.ItemsPerPage = itemsPerPage; model.Paging.TotalItems = result.TotalItems; return View(model); }
public ActionResult Index(int start = PaginationConstants.StartItemIndex, int count = PaginationConstants.ItemsOnPage, string searchByName = null, bool partial = false) { LoadCachedModelState(); var apiResourcesResult = m_apiResourceManager.GetApiResources(start, count, searchByName); var itemsCountResult = m_apiResourceManager.GetApiResourcesCount(searchByName); if (apiResourcesResult.HasError) { ModelState.AddModelError(apiResourcesResult.Error.Message); return(View()); } if (itemsCountResult.HasError) { ModelState.AddModelError(itemsCountResult.Error.Message); return(View()); } ViewData["search"] = searchByName; var apiResourceViewModels = Mapper.Map <List <ApiResourceViewModel> >(apiResourcesResult.Result); var itemsCount = itemsCountResult.Result; var vm = ViewModelFactory.GetListViewModel(apiResourceViewModels, Translator.Translate("delete-api-resource-confirm-dialog-title"), Translator.Translate("delete-api-resource-confirm-dialog-message"), itemsCount, count); if (partial) { return(PartialView("_ApiResourceList", vm)); } return(View(vm)); }