Esempio n. 1
0
        public ActionResult DeleteComment(string CommentGuid)
        {
            shCommentService _comment = new shCommentService();


            using (var context = new ShopOnlineDb())
            {
                using (var dbContextTransaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        if (!string.IsNullOrEmpty(CommentGuid) || !string.IsNullOrWhiteSpace(CommentGuid))
                        {
                            shComment comment = _comment.FindByKey(CommentGuid);
                            comment.Status = false;
                            _comment.Update(comment);
                        }

                        dbContextTransaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        dbContextTransaction.Rollback();
                    }
                }
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public PartialViewResult DsChildComment(string ProductGuid)
        {
            shCommentService _comment = new shCommentService();

            IEnumerable <shComment> dsComment = _comment.DanhSachComment_ByProductGuid(ProductGuid, null);

            return(PartialView("DsChildComment", dsComment));
        }
Esempio n. 3
0
        /// <summary>
        /// Comment của thành viên dành cho sản phẩm
        /// </summary>
        /// <param name="ProductGuid"></param>
        /// <returns></returns>
        public ActionResult CommentProduct(string ProductGuid, int?page)
        {
            int pageCurrent = 1;

            if (page.HasValue)
            {
                pageCurrent = page.Value;
            }

            shCommentService _comment = new shCommentService();

            IPagedList <shComment> dsComment = _comment.DanhSachComment_ByProductGuid_PhanTrang(ProductGuid, pageCurrent, Config.PAGE_SIZE_2, true);

            return(PartialView("CommentProduct", dsComment));
        }
Esempio n. 4
0
        public PartialViewResult ListComment(int?page)
        {
            int pageCurrent = 1;

            if (page.HasValue)
            {
                pageCurrent = page.Value;
            }

            shProductService        _product  = new shProductService();
            IEnumerable <shProduct> dsProduct = _product.DanhSachProduct();

            shCommentService     _comment          = new shCommentService();
            IEnumerable <string> dsComment_Product = _comment.DanhSachComment(true).Select(x => x.ProductGuid).Distinct();

            dsProduct         = dsProduct.Join(dsComment_Product, x => x.ProductGuid, comment => comment, (x, ProductGuid) => x);
            ViewBag.dsProduct = dsProduct.ToPagedList(pageCurrent, Config.PAGE_SIZE_20);
            return(PartialView("ListComment", ViewBag.dsProduct));
        }
Esempio n. 5
0
        public ActionResult PostComment(string rating, string name, string email, string content, string productguid)
        {
            shCommentService _comment = new shCommentService();

            shComment comment = _comment.Insert_UpdateComment(
                null,
                null,
                null,
                productguid,
                email,
                name,
                TypeHelper.ToInt32(rating),
                content,
                true,
                DateTime.Now);


            if (Request.IsAjaxRequest())
            {
                return(Json("OK", JsonRequestBehavior.AllowGet));
            }
            return(View());
        }