public JsonResult GetbyID(int ID)
        {
            var bookcategory = _bookCategoryService.GetById(ID);

            return(Json(new
            {
                CategoryID = bookcategory.CategoryID,
                CategoryName = bookcategory.CategoryName,
                SeoTitle = bookcategory.SeoTitle,
                MetaKeywords = bookcategory.MetaKeywords,
                MetaDescription = bookcategory.MetaDescription,
                Status = bookcategory.Status,
                CreatedDate = bookcategory.CreatedDate,
                CreatedBy = bookcategory.CreatedBy,
                ShowOnHome = bookcategory.ShowOnHome
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
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();
 }
Exemplo n.º 3
0
 public async Task <ActionResult <ApiResponse> > Get(int id)
 {
     return(new ApiResponse($"Book category with {id} retrived.",
                            mapper.Map <BookCategoryDto>(await bookCategoryService.GetById(id))));
 }
        public IActionResult GetById(int id)
        {
            var model = _bookCategoryService.GetById(id);

            return(new OkObjectResult(model));
        }