Example #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;
        }
Example #2
0
        public int addPost(BaiNhanXet baiNhanXet)
        {
            try
            {
                BaiNhanXet result = db.BaiNhanXet.Add(baiNhanXet);
                db.SaveChanges();

                return(result.MaSo);
            }

            catch (Exception e)
            {
                return(-1);
            }
        }
Example #3
0
        public bool editPost(BaiNhanXet baiNhanXet)
        {
            try
            {
                db.Entry(baiNhanXet).State = EntityState.Modified;
                db.SaveChanges();


                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Example #4
0
        public int addPost(BaiNhanXet baiNhanXet)
        {
            try
            {
                BaiNhanXet result = db.BaiNhanXet.Add(baiNhanXet);
                db.SaveChanges();

                return result.MaSo;
            }

            catch (Exception e)
            {

                return -1;
            }
        }
Example #5
0
        public bool deletePost(int IDPost)
        {
            try
            {
                BaiNhanXet temp = db.BaiNhanXet.Where(x => x.MaSo == IDPost).FirstOrDefault();
                temp.TinhTrang = false;


                List <BinhChon> lstBinhChon = db.BinhChon.ToList();
                foreach (BinhChon binhChon in lstBinhChon) //Đánh dấu bỏ những bài bình chọn liên quan
                {
                    if (binhChon.MS_BaiNhanXet == IDPost)
                    {
                        binhChon.TinhTrang = false;
                    }
                }
                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
        public ActionResult CreateNewPost(PhimViewModels phim)
        {
            BaiNhanXet baiNhanXet = new BaiNhanXet();
            baiNhanXet.TinhTrang = true;
            baiNhanXet.MS_Phim = phim.MaSo;
            baiNhanXet.TieuDe = phim.title;
            baiNhanXet.NgayDang = System.DateTime.Now;
            if (phim.contentPost == null)
                phim.contentPost = "";
            baiNhanXet.NoiDung = phim.contentPost;
            baiNhanXet.MS_TaiKhoan = User.Identity.GetUserId();

            ReviewFilmService reviewS = new ReviewFilmService();

            int result = reviewS.addPost(baiNhanXet);


            return RedirectToAction("Index", new {IDPhim =  baiNhanXet.MS_Phim , IDReview= result });
        }
        public ActionResult EditedPost(PhimViewModels phim)
        {

            FilmService bus = new FilmService();

            BaiNhanXet baiNhanXet = new BaiNhanXet();
            baiNhanXet.MaSo = phim.MaSoBaiNhanXet;
            baiNhanXet.TinhTrang = true;
            baiNhanXet.MS_Phim = phim.MaSo;
            baiNhanXet.TieuDe = phim.title;
            baiNhanXet.NgayDang = System.DateTime.Now;
            baiNhanXet.NoiDung = phim.contentPost;
            baiNhanXet.MS_TaiKhoan = User.Identity.GetUserId();

            ReviewFilmService reviewS = new ReviewFilmService();

            bool result = reviewS.editPost(baiNhanXet);

            return RedirectToAction("Index", new { IDPhim = baiNhanXet.MS_Phim, IDReview = phim.MaSoBaiNhanXet });
         
        }
Example #8
0
 internal bool editPost(BaiNhanXet baiNhanXet)
 {
     ReviewFilmsBus bus = new ReviewFilmsBus();
     return bus.editPost(baiNhanXet);
 }
        internal int addPost(Business.BaiNhanXet baiNhanXet)
        {
            ReviewFilmsBus bus = new ReviewFilmsBus();

            return(bus.addPost(baiNhanXet));
        }
Example #10
0
        public bool editPost(BaiNhanXet baiNhanXet)
        {
            try
            {
                db.Entry(baiNhanXet).State = EntityState.Modified;
                db.SaveChanges();


                return true;
            }
            catch (Exception e)
            {
             
                return false;
            }
        }