public ActionResult HelpfulnessVotes_POST(
            [IoCModelBinder(typeof(SetIPAddressModelBinder))] HelpfulnessVoteModel voteModel)
        {
            var response = _helpfulnessVoteService.Upvote(voteModel);

            if (Request.IsAjaxRequest())
            {
                return(Json(response.IsSuccess()));
            }

            TempData["productreview-response-info"] = response;
            return
                (Redirect(string.IsNullOrWhiteSpace(response.RedirectUrl)
                    ? Referrer != null
                        ? Referrer.ToString()
                        : "~/"
                    : response.RedirectUrl));

            //if (CurrentRequestData.CurrentUser != null)
            //    vote.User = CurrentRequestData.CurrentUser;

            //vote.IsHelpful = true;

            //_helpfulnessVoteService.Add(vote);

            //TempData["vote-submitted"] = true;

            //return Redirect(Referrer.ToString());
        }
예제 #2
0
        public RedirectResult Add_POST(ProductReview productReview)
        {
            _productReviewUIService.Add(productReview);

            TempData["review-submitted"] = true;

            return(Redirect(Referrer.ToString()));
        }
예제 #3
0
 public ActionResult LoggedIn([IoCModelBinder(typeof(SetIPAddressModelBinder))] LoggedInUserAddCommentModel model)
 {
     if (ModelState.IsValid)
     {
         PostCommentResponse response = _commentsUiService.AddLoggedInComment(model);
         return(RedirectToPage(response));
     }
     return(RedirectToPage(new PostCommentResponse {
         Valid = false, RedirectUrl = Referrer.ToString()
     }));
 }
예제 #4
0
        protected ActionResult RedirectToPage(ICommentResponseInfo response)
        {
            TempData["comment-response-info"] = response;
            var url = string.IsNullOrWhiteSpace(response.RedirectUrl)
                ? Referrer != null
                    ? Referrer.ToString()
                    : "~/"
                : response.RedirectUrl;

            return
                (Redirect(url + "#comments"));
        }
        public RedirectResult Add_POST(ProductReview productReview)
        {
            _productReviewUIService.Add(productReview);

            TempData["review-submitted"] = true;

            var url = Referrer.ToString();

            if (!url.Contains("#product-review"))
            {
                url += "#product-reviews";
            }
            return(Redirect(url));
        }
예제 #6
0
 public RedirectResult BackInStock(BackInStockNotificationRequest request)
 {
     if (ModelState.IsValid)
     {
         _backInStockNotificationService.SaveRequest(request);
         TempData["back-in-stock"] = true;
         if (request.ProductVariant != null && request.ProductVariant.Product != null)
         {
             return
                 (Redirect(string.Format("~/{0}?variant={1}", request.ProductVariant.Product.LiveUrlSegment,
                                         request.ProductVariant.Id)));
         }
     }
     return(Redirect(Referrer.ToString()));
 }
예제 #7
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            // HTTP GET
            // if it's a GET
            if (filterContext.HttpContext.Request.HttpMethod.Equals("GET", StringComparison.OrdinalIgnoreCase))
            {
                // merge in any invalid modelstate found
                var modelStateDictionary = TempData["MrCMS-invalid-modelstate"] as ModelStateDictionary;
                if (modelStateDictionary != null)
                {
                    ModelState.Merge(modelStateDictionary);
                }
            }

            // HTTP POST
            // if model state is invalid and it's a post
            if (!ModelState.IsValid &&
                filterContext.HttpContext.Request.HttpMethod.Equals("POST", StringComparison.OrdinalIgnoreCase))
            {
                // persist the model state to the tempdata dictionary
                TempData["MrCMS-invalid-modelstate"] = ModelState;
                // redirect to the previous page
                filterContext.Result = new RedirectResult(Referrer.ToString());
            }

            ViewData["controller-name"] = ControllerContext.RouteData.Values["controller"];
            string url = Request.Url.ToString();

            if (MrCMSApplication.Get <SiteSettings>().SSLAdmin&& url.ToLower().Contains("/admin"))
            {
                if (!Request.IsSecureConnection && !Request.IsLocal)
                {
                    filterContext.Result = new RedirectResult(url.Replace("http://", "https://"));
                }
            }

            SetDefaultPageTitle(filterContext);
            base.OnActionExecuting(filterContext);
        }
예제 #8
0
        public ActionResult Save(int id)
        {
            var webpage = _documentService.GetDocument <Webpage>(id);

            if (webpage.IsDeleted)
            {
                return(new EmptyResult());
            }
            var saveFormData = _formPostingHandler.SaveFormData(webpage, Request);

            TempData["form-submitted"]         = true;
            TempData["form-submitted-message"] = saveFormData;
            // if any errors add form data to be renderered, otherwise form should be empty
            TempData["form-data"] = saveFormData.Any() ? Request.Form : null;

            var redirectUrl = Referrer.ToString();

            if (!string.IsNullOrEmpty(webpage.FormRedirectUrl) && !saveFormData.Any())
            {
                redirectUrl = webpage.FormRedirectUrl;
            }
            return(Redirect(redirectUrl));
        }