public ActionResult Category(int? id, int? page)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
Genre category = db.Categories.Find(id);
if (category == null)
{
return HttpNotFound();
}
ViewBag.CategoryName = category.Name;
pageIndex = page.HasValue ? Convert.ToInt32(page) : 1;
var books = category.Books.OrderBy(b => b.BookId).ToPagedList(pageIndex, pageSize);
return View(books);
}