/// <summary>
        /// Prepare paged checkout attribute list model
        /// </summary>
        /// <param name="searchModel">Checkout attribute search model</param>
        /// <returns>Checkout attribute list model</returns>
        public virtual CheckoutAttributeListModel PrepareCheckoutAttributeListModel(CheckoutAttributeSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get checkout attributes
            var checkoutAttributes = _checkoutAttributeService.GetAllCheckoutAttributes();

            //prepare list model
            var model = new CheckoutAttributeListModel
            {
                Data = checkoutAttributes.PaginationByRequestModel(searchModel).Select(attribute =>
                {
                    //fill in model values from the entity
                    var attributeModel = attribute.ToModel <CheckoutAttributeModel>();

                    //fill in additional values (not existing in the entity)
                    attributeModel.AttributeControlTypeName = _localizationService.GetLocalizedEnum(attribute.AttributeControlType);

                    return(attributeModel);
                }),
                Total = checkoutAttributes.Count
            };

            return(model);
        }
Beispiel #2
0
        /// <summary>
        /// Prepare paged checkout attribute list model
        /// </summary>
        /// <param name="searchModel">Checkout attribute search model</param>
        /// <returns>Checkout attribute list model</returns>
        public virtual CheckoutAttributeListModel PrepareCheckoutAttributeListModel(CheckoutAttributeSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get checkout attributes
            var checkoutAttributes = _checkoutAttributeService.GetAllCheckoutAttributes().ToPagedList(searchModel);

            //prepare list model
            var model = new CheckoutAttributeListModel().PrepareToGrid(searchModel, checkoutAttributes, () =>
            {
                return(checkoutAttributes.Select(attribute =>
                {
                    //fill in model values from the entity
                    var attributeModel = attribute.ToModel <CheckoutAttributeModel>();

                    //fill in additional values (not existing in the entity)
                    attributeModel.AttributeControlTypeName = _localizationService.GetLocalizedEnum(attribute.AttributeControlType);

                    return attributeModel;
                }));
            });

            return(model);
        }
        public ActionResult List()
        {
            var model = new CheckoutAttributeListModel
            {
                IsSingleStoreMode = Services.StoreService.IsSingleStoreMode(),
                GridPageSize      = _adminAreaSettings.GridPageSize
            };

            return(View(model));
        }
        public ActionResult List()
        {
            if (!_services.Permissions.Authorize(StandardPermissionProvider.ManageCatalog))
            {
                return(AccessDeniedView());
            }

            var model = new CheckoutAttributeListModel
            {
                GridPageSize = _adminAreaSettings.GridPageSize
            };

            model.AvailableStores = _services.StoreService.GetAllStores().ToSelectListItems();

            return(View(model));
        }