コード例 #1
0
 //Cấu hình trong RouteConfig
 //Controller thực hiện khi người dùng click chọn thể loại sách trên combobox hoặc trên bảng slide bên phải
 public ActionResult Category(string SeoTitle, int page = 1, int pageSize = 20)
 {
     if (SeoTitle == "tat-ca-sach")
     {
         //var allBook = new BookRepository().GetAll();
         var allBook             = _bookService.ListAllWithPageListBook(page, pageSize);
         var TheLoaiSachDuocChon = _bookCategoryService.GetByString(SeoTitle);
         ViewBag.TheLoaiSach = _bookCategoryService.GetById(TheLoaiSachDuocChon.CategoryID);
         return(View(allBook));
     }
     else
     {
         var TheLoaiSachDuocChon = _bookCategoryService.GetByString(SeoTitle);
         //var BookTrongTheLoaiSachDuocChon = new BookRepository().ListBookByCategory(TheLoaiSachDuocChon.CategoryID);
         var BookTrongTheLoaiSachDuocChon = _bookService.ListBookByCategoryWithPageListBook(TheLoaiSachDuocChon.CategoryID, page, pageSize);
         ViewBag.TheLoaiSach = _bookCategoryService.GetById(TheLoaiSachDuocChon.CategoryID);
         return(View(BookTrongTheLoaiSachDuocChon));
     }
     //return View();
 }