Esempio n. 1
0
        public ActionResult ReviewsPagination(string productId, int pageNumber)
        {
            var model = new DetailModel();

            ReviewFilter reviewFilter = new ReviewFilter();

            reviewFilter.Code       = productId;
            reviewFilter.PageNumber = pageNumber;
            reviewFilter.Size       = PAGE_REVIEW_SIZE;

            model.ProductReviews = DetailManager.GetProductReviewModel(reviewFilter);

            return(PartialView("~/Views/Partials/Detail/_ReviewsPaginationPartial.cshtml", model));
        }
Esempio n. 2
0
        private DetailModel GetDetailModelFromProduct(String productId, BreadcrumbModel bc, bool buildNavigation = true)
        {
            DetailModel model;

            if (!String.IsNullOrEmpty(productId))
            {
                model = DetailManager.GetModel(this.CurrentBrand, productId);

                model.Breadcrumb = bc;

                //search for default category size containing default color
                model.ProductDetail.DefaultCategorySize = model.ColorsAndSizes.ProductCategorySizes.Count > 0 ? model.ColorsAndSizes.ProductCategorySizes[0] : null;
                foreach (var aSizeCategory in model.ColorsAndSizes.AvailableColorsPerSizeCategory)
                {
                    var match = aSizeCategory.Value.Find(c => c.ColorCode == model.ProductDetail.DefaultColorCode);

                    if (match != null)
                    {
                        model.ProductDetail.DefaultCategorySize = aSizeCategory.Key;
                        break;
                    }
                }

                ReviewFilter reviewFilter = new ReviewFilter();
                reviewFilter.Code       = productId;
                reviewFilter.PageNumber = 1;
                reviewFilter.Size       = PAGE_REVIEW_SIZE;
                model.ProductReviews    = DetailManager.GetProductReviewModel(reviewFilter);

                if (buildNavigation)
                {
                    BuildProductsNavigation(productId, bc, model);
                }
            }
            else
            {
                model = new DetailModel();
            }

            return(model);
        }