/// <summary> /// Prepare tier price model /// </summary> /// <param name="model">Tier price model</param> /// <param name="product">Product</param> /// <param name="tierPrice">Tier price</param> /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param> /// <returns>Tier price model</returns> public virtual TierPriceModel PrepareTierPriceModel(TierPriceModel model, Category category, TierPrice tierPrice, bool excludeProperties = false) { if (category == null) { throw new ArgumentNullException(nameof(category)); } if (tierPrice != null) { //fill in model values from the entity if (model == null) { model = tierPrice.ToModel <TierPriceModel>(); } } //prepare available stores _baseAdminModelFactory.PrepareStores(model.AvailableStores); //prepare available customer roles _baseAdminModelFactory.PrepareCustomerRoles(model.AvailableCustomerRoles); return(model); }
public override TierPriceModel PrepareTierPriceModel(TierPriceModel model, Product product, TierPrice tierPrice, bool excludeProperties = false) { if (product == null) { throw new ArgumentNullException(nameof(product)); } if (tierPrice != null) { //fill in model values from the entity if (model == null) { model = tierPrice.ToModel <TierPriceModel>(); } } //prepare available stores _baseAdminModelFactory.PrepareStores(model.AvailableStores); //prepare available customer roles IEnumerable <CustomerRole> availableCustomerRoles = _customerService.GetAllCustomerRoles() .Where(x => x.SystemName.Contains(B2BRole.RoleSuffix)); foreach (var customerRole in availableCustomerRoles) { model.AvailableCustomerRoles.Add(new SelectListItem { Value = customerRole.Id.ToString(), Text = customerRole.Name }); } return(model); }