// GET: Product public ActionResult ProductInfo(string maSach) { int ms = Convert.ToInt32(maSach); List <Y_KIEN> cmt = BookViewContext.getComments(ms).OrderByDescending(n => n.NGAY).ToList(); List <Y_KIEN> Positivecmts = cmt.Where(yk => yk.DANH_GIA == "tích cực").ToList(); List <Y_KIEN> Negativecmts = cmt.Where(yk => yk.DANH_GIA == "tiêu cực").ToList(); List <Y_KIEN> Neutralcmts = cmt.Where(yk => yk.DANH_GIA == "trung lập").ToList(); ViewBag.PositiveCmts = Positivecmts; ViewBag.NegativeCmts = Negativecmts; ViewBag.NeutralCmts = Neutralcmts; BookDetails book = BookDetails.getBookDetails(ms); return(View(book)); }
// GET: Products public ActionResult Index(string search) { List <ProductView> books = new List <ProductView>(); string[] temp = null; if (search == "") { RedirectToAction("Index"); } else { temp = search.Split('?'); } if (temp.Count() == 1) { switch (search) { case "All": books = BookViewContext.getAllBooksIncAuthor(); break; case "Top": books = BookViewContext.getTopBooksIncAuthor(); break; default: books = BookViewContext.getTopBooksIncAuthorByCategory(search); break; } } else { books = temp[0] == "1"? BookViewContext.getTopBooksIncAuthorByAuthor(temp[1]):BookViewContext.getTopBooksIncAuthorByName(temp[1]); } return(View(books)); }
// GET: Home public ActionResult Index() { List <ProductView> books = BookViewContext.getAllBooksIncAuthor(); return(View(books)); }
public ActionResult getPositiveComments(int ma_sach) { List <Y_KIEN> cmts = BookViewContext.getPositiveComments(ma_sach); return(Json(new { list = cmts }, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveComment(int ma_sach, string cmt) { BookViewContext.addComment(ma_sach, cmt); return(Json("abc", JsonRequestBehavior.AllowGet)); }