public ActionResult DeleteConfirmed(int id) { var productReview = _customerContentService.GetCustomerContentById(id) as ProductReview; if (productReview == null) { return(RedirectToAction("List")); } var product = productReview.Product; _customerContentService.DeleteCustomerContent(productReview); _productService.UpdateProductReviewTotals(product); NotifySuccess(T("Admin.Catalog.ProductReviews.Deleted")); return(RedirectToAction("List")); }
public ActionResult CommentDelete(int?filterByNewsItemId, int id, GridCommand command) { var comment = _customerContentService.GetCustomerContentById(id) as NewsComment; var newsItem = comment.NewsItem; _customerContentService.DeleteCustomerContent(comment); _newsService.UpdateCommentTotals(newsItem); return(Comments(filterByNewsItemId, command)); }
public ActionResult CommentDelete(int?filterByBlogPostId, int id, GridCommand command) { var comment = _customerContentService.GetCustomerContentById(id) as BlogComment; var blogPost = comment.BlogPost; _customerContentService.DeleteCustomerContent(comment); //update totals _blogService.UpdateCommentTotals(blogPost); return(Comments(filterByBlogPostId, command)); }
public ActionResult CommentDelete(int?filterByNewsItemId, int id, GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews)) { return(AccessDeniedView()); } var comment = _customerContentService.GetCustomerContentById(id); _customerContentService.DeleteCustomerContent(comment); return(Comments(filterByNewsItemId, command)); }
public ActionResult DeleteConfirmed(int id) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCatalog)) { return(AccessDeniedView()); } var productReview = _customerContentService.GetCustomerContentById(id) as ProductReview; if (productReview == null) { //No product review found with the specified id return(RedirectToAction("List")); } var product = productReview.Product; _customerContentService.DeleteCustomerContent(productReview); //update product totals _productService.UpdateProductReviewTotals(product); NotifySuccess(_localizationService.GetResource("Admin.Catalog.ProductReviews.Deleted")); return(RedirectToAction("List")); }
public ActionResult CommentDelete(int?filterByBlogPostId, int id, GridCommand command) { if (_permissionService.Authorize(StandardPermissionProvider.ManageBlog)) { var comment = _customerContentService.GetCustomerContentById(id) as BlogComment; var blogPost = comment.BlogPost; _customerContentService.DeleteCustomerContent(comment); //update totals _blogService.UpdateCommentTotals(blogPost); } return(Comments(filterByBlogPostId, command)); }
public ActionResult CommentDelete(int?filterByNewsItemId, int id, GridCommand command) { if (_permissionService.Authorize(StandardPermissionProvider.ManageNews)) { var comment = _customerContentService.GetCustomerContentById(id) as NewsComment; var newsItem = comment.NewsItem; _customerContentService.DeleteCustomerContent(comment); //update totals _newsService.UpdateCommentTotals(newsItem); } return(Comments(filterByNewsItemId, command)); }
public ActionResult CommentDelete(int?filterByNewsItemId, int id, GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageNews)) { return(AccessDeniedView()); } var comment = _customerContentService.GetCustomerContentById(id); if (comment == null) { throw new ArgumentException("No comment found with the specified id"); } _customerContentService.DeleteCustomerContent(comment); return(Comments(filterByNewsItemId, command)); }
public ActionResult CommentDelete(int?filterByBlogPostId, int id, GridCommand command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageBlog)) { return(AccessDeniedView()); } var comment = _customerContentService.GetCustomerContentById(id) as BlogComment; if (comment == null) { throw new ArgumentException("No comment found with the specified id"); } var blogPost = comment.BlogPost; _customerContentService.DeleteCustomerContent(comment); //update totals _blogService.UpdateCommentTotals(blogPost); return(Comments(filterByBlogPostId, command)); }
public ActionResult SetReviewHelpfulness(int productReviewId, bool washelpful) { var productReview = _customerContentService.GetCustomerContentById(productReviewId) as ProductReview; if (productReview == null) { throw new ArgumentException(T("Reviews.NotFound", productReviewId)); } if (_services.WorkContext.CurrentCustomer.IsGuest() && !_catalogSettings.AllowAnonymousUsersToReviewProduct) { return(Json(new { Success = false, Result = T("Reviews.Helpfulness.OnlyRegistered").Text, TotalYes = productReview.HelpfulYesTotal, TotalNo = productReview.HelpfulNoTotal })); } //customers aren't allowed to vote for their own reviews if (productReview.CustomerId == _services.WorkContext.CurrentCustomer.Id) { return(Json(new { Success = false, Result = T("Reviews.Helpfulness.YourOwnReview").Text, TotalYes = productReview.HelpfulYesTotal, TotalNo = productReview.HelpfulNoTotal })); } // delete previous helpfulness var oldPrh = (from prh in productReview.ProductReviewHelpfulnessEntries where prh.CustomerId == _services.WorkContext.CurrentCustomer.Id select prh).FirstOrDefault(); if (oldPrh != null) { _customerContentService.DeleteCustomerContent(oldPrh); } // insert new helpfulness var newPrh = new ProductReviewHelpfulness { ProductReviewId = productReview.Id, CustomerId = _services.WorkContext.CurrentCustomer.Id, IpAddress = _services.WebHelper.GetCurrentIpAddress(), WasHelpful = washelpful, IsApproved = true, //always approved }; _customerContentService.InsertCustomerContent(newPrh); // new totals int helpfulYesTotal = (from prh in productReview.ProductReviewHelpfulnessEntries where prh.WasHelpful select prh).Count(); int helpfulNoTotal = (from prh in productReview.ProductReviewHelpfulnessEntries where !prh.WasHelpful select prh).Count(); productReview.HelpfulYesTotal = helpfulYesTotal; productReview.HelpfulNoTotal = helpfulNoTotal; _customerContentService.UpdateCustomerContent(productReview); return(Json(new { Success = true, Result = T("Reviews.Helpfulness.SuccessfullyVoted").Text, TotalYes = productReview.HelpfulYesTotal, TotalNo = productReview.HelpfulNoTotal })); }