// GET: Admin/Book public ActionResult Index() { //get list books which are active and order by descending modified date List <Book> list = BookDao.GetListBooks().OrderByDescending(m => m.ModifiedDate).ToList(); return(PartialView("_IndexBook", list)); }
public ActionResult PartialIndex(int?page, int authorID = 0, int categoryID = 0) { ViewBag.AuthorID = authorID; ViewBag.CategoryID = categoryID; int pageNumber = page ?? 1; var listBooks = BookDao.GetListBooks().ToList(); if (authorID > 0) { listBooks = listBooks.Where(m => m.AuthorID == authorID && m.IsActive).ToList(); categoryID = 0; } if (categoryID > 0) { listBooks = listBooks.Where(m => m.CategoryID == categoryID && m.IsActive).ToList(); authorID = 0; } ViewBag.CurrentAuthorID = authorID; ViewBag.CurrentCategoryID = categoryID; Cart cart = (Cart)Session[SessionBox.CART_SESSION]; if (cart == null) { cart = new Cart(); } ViewBag.Cart = cart; return(PartialView("_Index", listBooks.ToPagedList(pageNumber, 8))); }