상속: Nop.Core.BaseEntity
        public ActionResult EditExtendedReviewPost(int OrderId, int ProductId, PublicReviewEditModel model)
        {

            var ProductReview = model.AddProductReviewModel;
            var VendorReview = model.VendorReviewListModel;
            var customer = _workContext.CurrentCustomer;
            var product = _productService.GetProductById(ProductId);
            if (product == null || product.Deleted || !product.Published || !product.AllowCustomerReviews)
                return RedirectToRoute("HomePage");
            if (ModelState.IsValid)
            {
                var canCustomerReviewVendor = _extendedVendorService.CanCustomerReviewVendor(product.VendorId, customer.Id, OrderId);
                if (!canCustomerReviewVendor)
                {
                    return InvokeHttp404();
                }

                var customerProductReviews = product.ProductReviews.Where(m => m.CustomerId == customer.Id).OrderByDescending(m => m.CreatedOnUtc);
                var rating = ProductReview.Rating;
                if (rating < 1 || rating > 5)
                    rating = _catalogSettings.DefaultProductRatingValue;
                var isApproved = !_catalogSettings.ProductReviewsMustBeApproved;
                ProductReview productReview;
                if (customerProductReviews.Any())
                {
                    productReview = customerProductReviews.First();
                    productReview.Title = ProductReview.Title;
                    productReview.ReviewText = ProductReview.ReviewText;
                    productReview.Rating = rating;
                    productReview.IsApproved = isApproved;
                    //updating
                }
                else
                {
                    productReview = new ProductReview() {
                        ProductId = product.Id,
                        CustomerId = _workContext.CurrentCustomer.Id,
                        Title = ProductReview.Title,
                        ReviewText = ProductReview.ReviewText,
                        Rating = rating,
                        HelpfulYesTotal = 0,
                        HelpfulNoTotal = 0,
                        IsApproved = isApproved,
                        CreatedOnUtc = DateTime.UtcNow,
                    };
                    product.ProductReviews.Add(productReview);
                }
                _productService.UpdateProduct(product);

                //update product totals
                _productService.UpdateProductReviewTotals(product);

                //notify store owner
                if (_catalogSettings.NotifyStoreOwnerAboutNewProductReviews)
                    _workflowMessageService.SendProductReviewNotificationMessage(productReview, _localizationSettings.DefaultAdminLanguageId);

                //activity log
                _customerActivityService.InsertActivity("PublicStore.AddProductReview", _localizationService.GetResource("ActivityLog.PublicStore.AddProductReview"), product.Name);


                rating = VendorReview.Rating;
                if (rating < 1 || rating > 5)
                    rating = _catalogSettings.DefaultProductRatingValue;


                var vendorReview = _extendedVendorService.GetVendorReview(product.VendorId, customer.Id, OrderId, ProductId);
                if (vendorReview == null)
                {
                    vendorReview = new VendorReview() {
                        IsApproved = isApproved,
                        CertifiedBuyerReview = true,
                        DisplayCertifiedBadge = true,
                        CreatedOnUTC = DateTime.Now,
                        CustomerId = customer.Id,
                        HelpfulnessNoTotal = 0,
                        HelpfulnessYesTotal = 0,
                        OrderId = OrderId,
                        ProductId = product.Id,
                        Rating = rating,
                        ReviewText = VendorReview.ReviewText,
                        Title = VendorReview.Title,
                        VendorId = product.VendorId
                    };
                }
                else
                {
                    vendorReview.IsApproved = isApproved;
                    vendorReview.ReviewText = VendorReview.ReviewText;
                    vendorReview.Title = VendorReview.Title;
                    vendorReview.Rating = rating;
                    vendorReview.HelpfulnessYesTotal = 0;
                    vendorReview.HelpfulnessNoTotal = 0;
                }
                _extendedVendorService.SaveVendorReview(vendorReview);
                return RedirectToRoute("ExtendedVendorReviewCenterLoader", new { Redirection = true });
            }
            else
            {
                return RedirectToRoute("HomePage");
            }
        }
 public void SaveVendorReview(VendorReview VendorReview)
 {
     if (VendorReview.Id == 0)
         _vendorReviewRepository.Insert(VendorReview);
     else
         _vendorReviewRepository.Update(VendorReview);
 }
        public ActionResult SaveReview(VendorReviewModel model)
        {
            //only requested review
            var custId = _workContext.CurrentCustomer.Id;
            if (!_extendedVendorService.IsVendorReviewDone(model.VendorId, custId, model.OrderId, model.ProductId))
            {
                //check if customer can review this vendor for this order
                if (_extendedVendorService.CanCustomerReviewVendor(model.VendorId, custId, model.OrderId))
                {
                    //yes he can
                    var review = new VendorReview {
                        CreatedOnUTC = DateTime.Now,
                        CustomerId = custId,
                        HelpfulnessNoTotal = 0,
                        HelpfulnessYesTotal = 0,
                        IsApproved = false,
                        OrderId = model.OrderId,
                        ProductId = model.ProductId,
                        Rating = model.Rating,
                        ReviewText = model.ReviewText,
                        Title = model.Title,
                        VendorId = model.VendorId
                    };

                    _extendedVendorService.SaveVendorReview(review);

                }
            }
            else
            {
                return Json(new {
                    success = false,
                    error = "You have already reviewed this order"
                });
            }
            return Json(new {
                success = false,
                error = "You need to login to review a vendor"
            });
        }
 public void DeleteVendorReview(VendorReview VendorReview)
 {
     _vendorReviewRepository.Delete(VendorReview);
 }