예제 #1
0
        public TopReviewModels BaiNhanXet2BaiNhanXetViewModels(BaiNhanXet topReview)
        {
            
            AccountBus acBus = new AccountBus();
            ReviewFilmsBus bus = new ReviewFilmsBus();
            ThanhVien temp = acBus.getMemberByUserId(topReview.MS_TaiKhoan);

            TopReviewModels result = new TopReviewModels();

            result.UserName = temp.HoTen;
            result.postDate = (DateTime) topReview.NgayDang;

            result.content = topReview.NoiDung;
            result.totalRank = bus.getTotalRank(topReview.MaSo);

            result.title = topReview.TieuDe;
            result.MS_Phim = (int) topReview.MS_Phim;
            result.MS_ReView = (int) topReview.MaSo;

            FilmBus filmBus = new FilmBus();

            Phim p = filmBus.getFilmByID(result.MS_Phim.ToString());
            result.ulr_HinhAnh = p.HinhAnh;
            result.TenPhim = p.TenPhim;
            return result;
        }
예제 #2
0
        public ActionResult Insert_Film_Rate(int MS_Phim, string rating)
        {
            AccountBus ac = new AccountBus();
            ThanhVien result = ac.getMemberByUserId(User.Identity.GetUserId());
            RatingFilmServices film = new RatingFilmServices();


            // true đã có
            // false chưa có;
            if (film.addFilmLike(result.MS_TaiKhoan, MS_Phim, double.Parse(rating)))
                return Content("success");
            else
                return Content("failure");
        }
예제 #3
0
        public ActionResult Insert_Film_Like(int MS_Phim)
        {
            AccountBus ac = new AccountBus();
            ThanhVien result = ac.getMemberByUserId(User.Identity.GetUserId());
            FilmLikeService film = new FilmLikeService();

            
            // true đã có
            // false chưa có;
            if (film.addFilmLike(result.MS_TaiKhoan, MS_Phim))
                return Content("success");
            else
                return Content("failure");
        }
예제 #4
0
        private List<TopReviewModels> BaiNhanXet2TopReviewModel(List<BaiNhanXet> lstBaiNhanXet)
        {
            List<TopReviewModels> result = new List<TopReviewModels>();

            AccountBus acBus = new AccountBus();
            foreach (BaiNhanXet baiNhanXet in lstBaiNhanXet)
            {
                TopReviewModels temp = new TopReviewModels();


                temp.MS_Phim = (int) baiNhanXet.MS_Phim;
                temp.MS_ReView = baiNhanXet.MaSo;
                temp.MS_TaiKhoan = baiNhanXet.MS_TaiKhoan;
                ThanhVien thanhVien = acBus.getMemberByUserId(temp.MS_TaiKhoan);
                temp.UserName = thanhVien.HoTen;
                temp.postDate = (DateTime) baiNhanXet.NgayDang;
                temp.TenPhim = baiNhanXet.Phim.TenPhim;
                temp.title = baiNhanXet.TieuDe;
                temp.content = baiNhanXet.NoiDung;
                temp.ulr_HinhAnh = baiNhanXet.Phim.HinhAnh;
                result.Add(temp);

            }
            return result;

        }
예제 #5
0
        private CommentViewModels BinhLuan2ViewModels(BinhLuan p)
        {
            CommentViewModels result = new CommentViewModels();

            result.datePost = (DateTime) p.NgayDang;
            result.content = p.NoiDung;

            AccountBus acBus = new AccountBus();
            
            ThanhVien temp = acBus.getMemberByUserId(p.MS_ThanhVien.ToString());

            result.url_Avatar = temp.Avatar;
            result.fullName = temp.HoTen;

            result.IDPost = p.MS_BaiNhanXet.ToString();

            return result;


        }
예제 #6
0
        public ActionResult IsLiked(int MS_Phim)
        {

            // o tren nay se kiem tra no dang nhap hay chua
            if (User == null)
            {
                return Content("");
            }
            else
            {
                // doan nay la no ra dang nhap roi
                AccountBus ac = new AccountBus();
                ThanhVien result = ac.getMemberByUserId(User.Identity.GetUserId());
                FilmLikeService film = new FilmLikeService();

                if (film.checkList(result.MS_TaiKhoan, MS_Phim))
                    return Content("btn-success");
                else
                    return Content("");
            }
        }
예제 #7
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;

        }