Ejemplo n.º 1
0
        // 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));
        }
Ejemplo n.º 2
0
        // 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));
        }
Ejemplo n.º 3
0
        // GET: Home
        public ActionResult Index()
        {
            List <ProductView> books = BookViewContext.getAllBooksIncAuthor();

            return(View(books));
        }
Ejemplo n.º 4
0
        public ActionResult getPositiveComments(int ma_sach)
        {
            List <Y_KIEN> cmts = BookViewContext.getPositiveComments(ma_sach);

            return(Json(new { list = cmts }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
 public JsonResult SaveComment(int ma_sach, string cmt)
 {
     BookViewContext.addComment(ma_sach, cmt);
     return(Json("abc", JsonRequestBehavior.AllowGet));
 }