Exemple #1
0
        public ActionResult Add()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageProductReviews))
            {
                return(AccessDeniedView());
            }

            var model = new ProductQuestionModel();

            return(View("Edit", model));
        }
Exemple #2
0
        public ActionResult Add(ProductQuestionModel model)
        {
            ProductQuestion productQuestion = new ProductQuestion();

            productQuestion.Title        = model.Title;
            productQuestion.QuestionText = model.QuestionText;
            productQuestion.OrderNum     = model.OrderNum;

            _productService.AddProductQuestion(productQuestion);

            return(RedirectToAction("List"));
        }
Exemple #3
0
        protected void PrepareProductQuestionModel(ProductQuestionModel model,
                                                   ProductQuestion productQuestion, bool excludeProperties, bool formatReviewText)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            if (productQuestion == null)
            {
                throw new ArgumentNullException("ProductQuestion");
            }

            model.Id           = productQuestion.Id;
            model.OrderNum     = productQuestion.OrderNum;
            model.QuestionText = productQuestion.QuestionText;
            model.Title        = productQuestion.Title;
        }
Exemple #4
0
        //edit
        public ActionResult Edit(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageProductReviews))
            {
                return(AccessDeniedView());
            }

            var productQuestion = _productService.GetProductQuestionById(id);

            if (productQuestion == null)
            {
                //No product review found with the specified id
                return(RedirectToAction("List"));
            }

            var model = new ProductQuestionModel();

            PrepareProductQuestionModel(model, productQuestion, false, false);
            return(View(model));
        }
Exemple #5
0
        public ActionResult List(DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageProductReviews))
            {
                return(AccessDeniedView());
            }

            var productQuestions = _productService.GetAllProductQuestion();
            var gridModel        = new DataSourceResult
            {
                Data = productQuestions.PagedForCommand(command).Select(x =>
                {
                    var m = new ProductQuestionModel();
                    PrepareProductQuestionModel(m, x, false, true);
                    return(m);
                }),
                Total = productQuestions.Count,
            };

            return(Json(gridModel));
        }
Exemple #6
0
        public ActionResult Edit(ProductQuestionModel model, bool continueEditing)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageProductReviews))
            {
                return(AccessDeniedView());
            }

            var productQuestion = _productService.GetProductQuestionById(model.Id);

            if (productQuestion == null)
            {
                //No product review found with the specified id
                return(RedirectToAction("Add", model));
            }


            productQuestion.Title        = model.Title;
            productQuestion.QuestionText = model.QuestionText;
            productQuestion.OrderNum     = model.OrderNum;
            _productService.UpdateProductQuestion(productQuestion);

            return(continueEditing ? RedirectToAction("Edit", productQuestion.Id) : RedirectToAction("List"));
        }