Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions LearningHub.Nhs.WebUI/Controllers/CatalogueController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ public async Task<IActionResult> GetAllCatalogueSearch(int pageIndex = 1, string
}

this.ViewBag.PageIndex = pageIndex;
this.ViewBag.PageSize = allCatalogueSearchPageSize;
return this.View("AllCatalogueSearch", catalogues);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
@{
ViewData["Title"] = "All Catalogues Search";

var queryParams = QueryHelpers.ParseQuery(Context.Request.QueryString.ToString().ToLower());
var queryParams = QueryHelpers.ParseQuery(Context.Request.QueryString.ToString());
var hasSearchTerm = queryParams.ContainsKey("term");
var searchTerm = hasSearchTerm ? queryParams["term"].ToString() : null;
string cardStyle = "card-provider-details--blank";
var pageSize = this.ViewBag.PageSize;
}

@section styles {
Expand Down Expand Up @@ -118,10 +119,10 @@
</li>
}
</ul>
@if (Model.TotalCount > 9)
@if (Model.TotalCount > pageSize)
{
var currentPage = this.ViewBag.PageIndex;
int totalPage = (Model.TotalCount / 9) + (Model.TotalCount % 9 == 0 ? 0 : 1);
int totalPage = (Model.TotalCount / pageSize) + (Model.TotalCount % pageSize == 0 ? 0 : 1);
var searchQueryParam = hasSearchTerm ? $"&term={searchTerm}" : string.Empty;
var prevUrl = $"/allcataloguesearch?pageindex={currentPage - 1}{searchQueryParam}";
var nextUrl = $"/allcataloguesearch?pageindex={currentPage + 1}{searchQueryParam}";
Expand Down