/// <summary> /// Prepare paged vendor attribute list model /// </summary> /// <param name="searchModel">Vendor attribute search model</param> /// <returns>Vendor attribute list model</returns> public virtual async Task <VendorAttributeListModel> PrepareVendorAttributeListModelAsync(VendorAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get vendor attributes var vendorAttributes = (await _vendorAttributeService.GetAllVendorAttributesAsync()).ToPagedList(searchModel); //prepare list model var model = await new VendorAttributeListModel().PrepareToGridAsync(searchModel, vendorAttributes, () => { return(vendorAttributes.SelectAwait(async attribute => { //fill in model values from the entity var attributeModel = attribute.ToModel <VendorAttributeModel>(); //fill in additional values (not existing in the entity) attributeModel.AttributeControlTypeName = await _localizationService.GetLocalizedEnumAsync(attribute.AttributeControlType); return attributeModel; })); }); return(model); }
public VendorSettingsModel() { VendorAttributeSearchModel = new VendorAttributeSearchModel(); }
/// <summary> /// Prepare vendor attribute search model /// </summary> /// <param name="searchModel">Vendor attribute search model</param> /// <returns>Vendor attribute search model</returns> public virtual Task <VendorAttributeSearchModel> PrepareVendorAttributeSearchModelAsync(VendorAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare page parameters searchModel.SetGridPageSize(); return(Task.FromResult(searchModel)); }