/// <summary> /// Prepare shopping cart search model /// </summary> /// <param name="searchModel">Shopping cart search model</param> /// <returns> /// A task that represents the asynchronous operation /// The task result contains the shopping cart search model /// </returns> public virtual async Task <ShoppingCartSearchModel> PrepareShoppingCartSearchModelAsync(ShoppingCartSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare available shopping cart types await _baseAdminModelFactory.PrepareShoppingCartTypesAsync(searchModel.AvailableShoppingCartTypes, false); //set default search values searchModel.ShoppingCartType = ShoppingCartType.ShoppingCart; //prepare available billing countries searchModel.AvailableCountries = (await _countryService.GetAllCountriesForBillingAsync(showHidden: true)) .Select(country => new SelectListItem { Text = country.Name, Value = country.Id.ToString() }).ToList(); searchModel.AvailableCountries.Insert(0, new SelectListItem { Text = await _localizationService.GetResourceAsync("Admin.Common.All"), Value = "0" }); //prepare available stores await _baseAdminModelFactory.PrepareStoresAsync(searchModel.AvailableStores); searchModel.HideStoresList = _catalogSettings.IgnoreStoreLimitations || searchModel.AvailableStores.SelectionIsNotPossible(); //prepare nested search model PrepareShoppingCartItemSearchModel(searchModel.ShoppingCartItemSearchModel); //prepare page parameters searchModel.SetGridPageSize(); return(searchModel); }
/// <summary> /// Prepare shopping cart search model /// </summary> /// <param name="searchModel">Shopping cart search model</param> /// <returns>Shopping cart search model</returns> public virtual ShoppingCartSearchModel PrepareShoppingCartSearchModel(ShoppingCartSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare available shopping cart types _baseAdminModelFactory.PrepareShoppingCartTypes(searchModel.AvailableShoppingCartTypes, false); //set default search values searchModel.ShoppingCartType = ShoppingCartType.ShoppingCart; //prepare nested search model PrepareShoppingCartItemSearchModel(searchModel.ShoppingCartItemSearchModel); //prepare page parameters searchModel.SetGridPageSize(); return(searchModel); }