/// <summary> /// Prepare paged customer attribute list model /// </summary> /// <param name="searchModel">Customer attribute search model</param> /// <returns>Customer attribute list model</returns> public virtual CustomerAttributeListModel PrepareCustomerAttributeListModel(CustomerAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get customer attributes var customerAttributes = _customerAttributeService.GetAllCustomerAttributes().ToPagedList(searchModel); //prepare list model var model = new CustomerAttributeListModel().PrepareToGrid(searchModel, customerAttributes, () => { return(customerAttributes.Select(attribute => { //fill in model values from the entity var attributeModel = attribute.ToModel <CustomerAttributeModel>(); //fill in additional values (not existing in the entity) attributeModel.AttributeControlTypeName = _localizationService.GetLocalizedEnum(attribute.AttributeControlType); return attributeModel; })); }); return(model); }
/// <summary> /// Prepare paged customer attribute list model /// </summary> /// <param name="searchModel">Customer attribute search model</param> /// <returns>Customer attribute list model</returns> public virtual CustomerAttributeListModel PrepareCustomerAttributeListModel(CustomerAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get customer attributes var customerAttributes = _customerAttributeService.GetAllCustomerAttributes(); //prepare list model var model = new CustomerAttributeListModel { Data = customerAttributes.PaginationByRequestModel(searchModel).Select(attribute => { //fill in model values from the entity var attributeModel = attribute.ToModel <CustomerAttributeModel>(); //fill in additional values (not existing in the entity) attributeModel.AttributeControlTypeName = _localizationService.GetLocalizedEnum(attribute.AttributeControlType); return(attributeModel); }), Total = customerAttributes.Count }; return(model); }
public CustomerUserSettingsModel() { CustomerSettings = new CustomerSettingsModel(); AddressSettings = new AddressSettingsModel(); DateTimeSettings = new DateTimeSettingsModel(); ExternalAuthenticationSettings = new ExternalAuthenticationSettingsModel(); CustomerAttributeSearchModel = new CustomerAttributeSearchModel(); AddressAttributeSearchModel = new AddressAttributeSearchModel(); }
public virtual async Task<IActionResult> List(CustomerAttributeSearchModel searchModel) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageSettings)) return await AccessDeniedDataTablesJson(); //prepare model var model = await _customerAttributeModelFactory.PrepareCustomerAttributeListModelAsync(searchModel); return Json(model); }
public virtual IActionResult List(CustomerAttributeSearchModel searchModel) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedDataTablesJson()); } //prepare model var model = _customerAttributeModelFactory.PrepareCustomerAttributeListModel(searchModel); return(Json(model)); }
/// <summary> /// Prepare customer attribute search model /// </summary> /// <param name="searchModel">Customer attribute search model</param> /// <returns>Customer attribute search model</returns> public virtual Task <CustomerAttributeSearchModel> PrepareCustomerAttributeSearchModelAsync(CustomerAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare page parameters searchModel.SetGridPageSize(); return(Task.FromResult(searchModel)); }
/// <summary> /// Prepare customer attribute search model /// </summary> /// <param name="searchModel">Customer attribute search model</param> /// <returns>Customer attribute search model</returns> public virtual CustomerAttributeSearchModel PrepareCustomerAttributeSearchModel(CustomerAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare page parameters searchModel.SetGridPageSize(); return(searchModel); }