@model Frontend.Models.PagedResult @{ ViewData["Title"] = "Books Catalog"; }

Books Catalog

Explore and discover your next great read. (@Model.TotalCount total)

@if (User.IsInRole("Librarian")) { }
@* Category Filter Pills *@ @{ var categories = ViewBag.Categories as IEnumerable ?? Enumerable.Empty(); int? selectedCategoryId = ViewBag.SelectedCategoryId; } @if (categories.Any()) {
Filter: All @foreach (var cat in categories) { @cat.Name }
}
@foreach (var book in Model.Items) {
@book.Isbn
@if (book.AvailableCopies <= 0) {
Out of Stock
}

@book.Title

@book.Author

@if (book.Categories.Any()) {
@foreach (var cat in book.Categories) { @cat.Name }
}
@book.Status @book.AvailableCopies / @book.TotalCopies
Details @if (User.IsInRole("Librarian")) { }
}
@* Pagination *@ @if (Model.TotalPages > 1) {

Showing @((Model.CurrentPage - 1) * Model.PageSize + 1)@(Math.Min(Model.CurrentPage * Model.PageSize, Model.TotalCount)) of @Model.TotalCount books

}