Inheritance: Nop.Web.Framework.Mvc.BaseNopEntityModel
        public ActionResult UpdateReview(VendorReviewModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageVendors))
                return Content("Access denied");


            var review = _extendedVendorService.GetVendorReview(model.Id);

            if (review == null)
                return new NullJsonResult();

            review.IsApproved = model.IsApproved;
            review.Rating = model.Rating;
            review.ReviewText = model.ReviewText;
            review.Title = model.Title;
            review.HelpfulnessNoTotal = model.HelpfulnessNoTotal;
            review.HelpfulnessYesTotal = model.HelpfulnessYesTotal;
            _extendedVendorService.SaveVendorReview(review);
            return new NullJsonResult();
        }
 public static VendorReviewModel ToModel(this VendorReview Review, Order Order, Product Product)
 {
     var model = new VendorReviewModel()
     {
         CreatedOnUTC = Review.CreatedOnUTC,
         CustomerId = Review.CustomerId,
         HelpfulnessNoTotal = Review.HelpfulnessNoTotal,
         HelpfulnessYesTotal = Review.HelpfulnessYesTotal,
         Id = Review.Id,
         IsApproved = Review.IsApproved,
         ProductId = Review.ProductId,
         Rating = Review.Rating,
         ReviewText = Review.ReviewText,
         Title = Review.Title,
         VendorId = Review.VendorId,
         OrderId = Review.OrderId,
         ProductName = Product.Name,
         CertifiedBuyerReview = Review.CertifiedBuyerReview,
         DisplayCertifiedBadge = Review.DisplayCertifiedBadge
     };
     return model;
 }
        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"
            });
        }