public IActionResult Index(string id)
        {
            ThucDonViewModel query = new ThucDonViewModel(db);
            var td = query.GetDataById(id);

            var thucDon = db.ThucDon.Find(Convert.ToInt32(id));

            if (thucDon.LuotXem == null)
            {
                thucDon.LuotXem = 1;
            }
            else
            {
                thucDon.LuotXem++;
            }

            db.Update(thucDon);
            db.SaveChanges();
            ViewBag.CungLoai = query.GetAllDataByCate(td.MaLoai.ToString()).Take(3);
            DanhGiaViewModel query_dg = new DanhGiaViewModel(db);

            ViewBag.ListDanhGia = query_dg.GetDanhGiaByProduct(id).OrderByDescending(x => x.MaDanhGia);
            ViewBag.ThucDon     = td;
            return(View());
        }
        public IActionResult Index()
        {
            DanhGiaViewModel query = new DanhGiaViewModel(db);

            ViewBag.ListReview = query.GetDsDanhGia().OrderByDescending(x => x.NgayDanhGia);
            return(View());
        }
Ejemplo n.º 3
0
        public IActionResult Index(string id)
        {
            ThucDonViewModel query = new ThucDonViewModel(db);
            var td = query.GetDataById(id);

            ViewBag.CungLoai = query.GetAllDataByCate(td.MaLoai.ToString()).Take(4);
            DanhGiaViewModel query_dg = new DanhGiaViewModel(db);

            ViewBag.ListDanhGia = query_dg.GetDanhGiaByProduct(id).OrderByDescending(x => x.MaDanhGia);
            return(View(td));
        }
Ejemplo n.º 4
0
        public IActionResult AddReview(string loiNX, string mTKhoan, string mThDon)
        {
            DanhGia dgianew = new DanhGia
            {
                MaTaiKhoan  = Convert.ToInt32(mTKhoan),
                MaThucDon   = Convert.ToInt32(mThDon),
                LoiNhanXet  = loiNX,
                NgayDanhGia = DateTime.Now
            };

            db.DanhGia.Add(dgianew);
            db.SaveChanges();
            DanhGiaViewModel query_dg = new DanhGiaViewModel(db);

            ViewBag.s1          = loiNX;
            ViewBag.s2          = mTKhoan;
            ViewBag.s3          = mThDon;
            ViewBag.ListDanhGia = query_dg.GetDanhGiaByProduct(mThDon).OrderByDescending(x => x.MaDanhGia);
            return(PartialView("_reviewresult", ViewBag.ListProduct));
        }