Beispiel #1
0
 public ActionResult Cmt(int?page)
 {
     if (page == null)
     {
         page = 1;
         return(PartialView("_Cmt", CommentBus.CmtSp((string)Session["MaSP"], page)));
     }
     else
     {
         Session["page"] = page;
         return(RedirectToAction("Details", "Product", new { id = (string)Session["MaSP"] }));
     }
 }
Beispiel #2
0
        public ActionResult Create(string Name, string Telephone, string Review, string Email, int id)
        {
            var cmt = new Comment();

            cmt.Content     = Review;
            cmt.DateCreated = DateTime.Now;
            cmt.ProductId   = id;
            cmt.Status      = true;
            cmt.Name        = Name;
            cmt.Email       = Email;
            cmt.Telephone   = Telephone;
            CommentBus.Insert(cmt);
            return(Redirect("/Product/Details/" + cmt.ProductId));
        }
Beispiel #3
0
        public JsonResult Delete(int id)
        {
            var result = new { Code = 1, Msg = "Fail" };

            try
            {
                CommentBus.Xoa(id);
                result = new { Code = 0, Msg = "Success" };
                return(Json(result));
            }
            catch
            {
                return(Json(result));
            }
        }
        public List <CommentViewModels> getComment(String IDPost)
        {
            CommentBus cmtBus = new CommentBus();

            List <CommentViewModels> result = new List <CommentViewModels>();

            List <BinhLuan> lst = cmtBus.getComments(Int32.Parse(IDPost));

            foreach (BinhLuan p in lst)
            {
                CommentViewModels pvm = BinhLuan2ViewModels(p);
                result.Add(pvm);
            }

            return(result);
        }
Beispiel #5
0
        public JsonResult Edit(int idCmt, string maSP, string userID, string mainCmt)
        {
            var     result = new { Code = 1, Msg = "Fail" };
            Comment cmt    = new Comment();

            cmt.IDCmt   = idCmt;
            cmt.MaSP    = maSP;
            cmt.UserCmt = userID;
            cmt.NoiDung = mainCmt;
            try
            {
                CommentBus.Sua(cmt);
                result = new { Code = 0, Msg = "Success" };
                return(Json(result));
            }
            catch
            {
                return(Json(result));
            }
        }
Beispiel #6
0
        public JsonResult Created(string userID, string mainCmt, string maSP)
        {
            var result = new { Code = 1, Msg = "Fail", idCmt = 0 };

            try
            {
                Comment cmt = new Comment();
                cmt.MaSP    = maSP;
                cmt.UserCmt = userID;
                cmt.NoiDung = mainCmt;
                CommentBus.Them(cmt);
                Comment cmt2 = new Comment();
                cmt2   = CommentBus.ChiTiet(userID);
                result = new { Code = 0, Msg = "Success", idCmt = cmt2.IDCmt };
                return(Json(result));
            }
            catch
            {
                return(Json(result));
            }
        }
Beispiel #7
0
 // GET: Comment
 public ActionResult Index(int id, int page = 1, int pageSize = 2)
 {
     ViewBag.ProductId = id;
     return(View(CommentBus.ProductComments(id).ToPagedList(page, pageSize)));
 }
Beispiel #8
0
        public List <HistoryViewModels> getActivitiesLog(string IDUser)
        {
            //ReviewFilmsBus reviewFilmsBus = new ReviewFilmsBus();
            List <HistoryViewModels> result = new List <HistoryViewModels>();

            CommentBus commentBus = new CommentBus();

            ReviewFilmsBus reviewBus = new ReviewFilmsBus();
            AccountBus     accBus    = new AccountBus();
            FilmBus        filmBus   = new FilmBus();
            ThanhVien      thanhVien = accBus.getMemberByUserId(IDUser);

            List <BinhLuan> lstBinhLuan = commentBus.getMyComments(IDUser);



            foreach (BinhLuan binhLuan in lstBinhLuan)
            {
                HistoryViewModels temp = new HistoryViewModels();

                BaiNhanXet baiNhanXet = reviewBus.getReview((int)binhLuan.MS_BaiNhanXet);
                Phim       phim       = filmBus.getFilmByID(baiNhanXet.MS_Phim.ToString());

                temp.tenBaiNhanXet = baiNhanXet.TieuDe;
                temp.MS_BaiNhanXet = (int)binhLuan.MS_BaiNhanXet;
                temp.tenPhim       = phim.TenPhim;
                temp.MS_Phim       = (int)phim.MaSo;
                temp.action        = "Comment";
                temp.Hoten         = thanhVien.HoTen;
                temp.content       = binhLuan.NoiDung;
                temp.dateAction    = (DateTime)binhLuan.NgayDang;
                result.Add(temp);
            }

            FilmLikeBus filmLikeBus = new FilmLikeBus();

            List <DanhSachPhimYeuThich> lstPhimYeuThich = filmLikeBus.getMyListFilmLike(IDUser);


            foreach (DanhSachPhimYeuThich phimYeuThich in lstPhimYeuThich)
            {
                HistoryViewModels temp = new HistoryViewModels();

                Phim p = filmBus.getFilmByID(phimYeuThich.MS_Phim.ToString());
                temp.tenPhim    = p.TenPhim;
                temp.MS_Phim    = p.MaSo;
                temp.Hoten      = thanhVien.HoTen;
                temp.action     = "Like";
                temp.content    = thanhVien.HoTen + " đã thích " + p.TenPhim;
                temp.dateAction = (DateTime)phimYeuThich.ThoiGian;
                result.Add(temp);
            }


            List <BaiNhanXet> lstNhanXet = reviewBus.getMyListReview(IDUser);

            foreach (BaiNhanXet baiNhanXet in lstNhanXet)
            {
                HistoryViewModels temp = new HistoryViewModels();
                Phim p = filmBus.getFilmByID(baiNhanXet.MS_Phim.ToString());
                temp.tenPhim       = p.TenPhim;
                temp.MS_Phim       = p.MaSo;
                temp.tenBaiNhanXet = baiNhanXet.TieuDe;
                temp.MS_BaiNhanXet = baiNhanXet.MaSo;
                temp.Hoten         = thanhVien.HoTen;
                temp.action        = "Post";
                temp.content       = thanhVien.HoTen + " đã thêm bài nhận xét ...." + baiNhanXet.MS_Phim;
                temp.dateAction    = (DateTime)baiNhanXet.NgayDang;
                result.Add(temp);
            }

            result.Sort((x, y) => y.dateAction.CompareTo(x.dateAction));


            return(result);
        }