/// <summary> /// Prepare paged address attribute list model /// </summary> /// <param name="searchModel">Address attribute search model</param> /// <returns>Address attribute list model</returns> public virtual AddressAttributeListModel PrepareAddressAttributeListModel(AddressAttributeSearchModel searchModel) { if (searchModel == null) throw new ArgumentNullException(nameof(searchModel)); //get address attributes var addressAttributes = _addressAttributeService.GetAllAddressAttributes(); //prepare grid model var model = new AddressAttributeListModel { Data = addressAttributes.PaginationByRequestModel(searchModel).Select(attribute => { //fill in model values from the entity var attributeModel = attribute.ToModel<AddressAttributeModel>(); //fill in additional values (not existing in the entity) attributeModel.AttributeControlTypeName = _localizationService.GetLocalizedEnum(attribute.AttributeControlType); return attributeModel; }), Total = addressAttributes.Count }; return model; }
/// <summary> /// Prepare paged address attribute list model /// </summary> /// <param name="searchModel">Address attribute search model</param> /// <returns>Address attribute list model</returns> public virtual AddressAttributeListModel PrepareAddressAttributeListModel(AddressAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get address attributes var addressAttributes = _addressAttributeService.GetAllAddressAttributes(); //prepare grid model var model = new AddressAttributeListModel { Data = addressAttributes.PaginationByRequestModel(searchModel).Select(attribute => { //fill in model values from the entity var attributeModel = attribute.ToModel <AddressAttributeModel>(); return(attributeModel); }), Total = addressAttributes.Count }; return(model); }
/// <summary> /// Prepare paged address attribute list model /// </summary> /// <param name="searchModel">Address attribute search model</param> /// <returns>Address attribute list model</returns> public virtual AddressAttributeListModel PrepareAddressAttributeListModel(AddressAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get address attributes var addressAttributes = _addressAttributeService.GetAllAddressAttributes().ToPagedList(searchModel); //prepare grid model var model = new AddressAttributeListModel().PrepareToGrid(searchModel, addressAttributes, () => { return(addressAttributes.Select(attribute => { //fill in model values from the entity var attributeModel = attribute.ToModel <AddressAttributeModel>(); //fill in additional values (not existing in the entity) attributeModel.AttributeControlTypeName = _localizationService.GetLocalizedEnum(attribute.AttributeControlType); return attributeModel; })); }); return(model); }
public CustomerUserSettingsModel() { CustomerSettings = new CustomerSettingsModel(); AddressSettings = new AddressSettingsModel(); DateTimeSettings = new DateTimeSettingsModel(); ExternalAuthenticationSettings = new ExternalAuthenticationSettingsModel(); CustomerAttributeSearchModel = new CustomerAttributeSearchModel(); AddressAttributeSearchModel = new AddressAttributeSearchModel(); }
public virtual IActionResult List(AddressAttributeSearchModel searchModel) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) { return(AccessDeniedKendoGridJson()); } //prepare model var model = _addressAttributeModelFactory.PrepareAddressAttributeListModel(searchModel); return(Json(model)); }
public virtual async Task <IActionResult> List(AddressAttributeSearchModel searchModel) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageSettings)) { return(await AccessDeniedDataTablesJson()); } //prepare model var model = await _addressAttributeModelFactory.PrepareAddressAttributeListModelAsync(searchModel); return(Json(model)); }
/// <summary> /// Prepare address attribute search model /// </summary> /// <param name="searchModel">Address attribute search model</param> /// <returns> /// A task that represents the asynchronous operation /// The task result contains the address attribute search model /// </returns> public virtual Task <AddressAttributeSearchModel> PrepareAddressAttributeSearchModelAsync(AddressAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare page parameters searchModel.SetGridPageSize(); return(Task.FromResult(searchModel)); }
/// <summary> /// Prepare address attribute search model /// </summary> /// <param name="searchModel">Address attribute search model</param> /// <returns>Address attribute search model</returns> public virtual AddressAttributeSearchModel PrepareAddressAttributeSearchModel(AddressAttributeSearchModel searchModel) { if (searchModel == null) throw new ArgumentNullException(nameof(searchModel)); //prepare page parameters searchModel.SetGridPageSize(); return searchModel; }