public virtual IActionResult ValueList(ContractAttributeValueSearchModel searchModel)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
            {
                return(AccessDeniedKendoGridJson());
            }

            //try to get a customer attribute with the specified id
            var contractAttribute = _contractAttributeService.GetContractAttributeById(searchModel.ContractAttributeId)
                                    ?? throw new ArgumentException("No contract attribute found with the specified id");

            //prepare model
            var model = _contractAttributeModelFactory.PrepareContractAttributeValueListModel(searchModel, contractAttribute);

            return(Json(model));
        }
示例#2
0
        protected virtual ContractAttributeValueSearchModel PrepareContractAttributeValueSearchModel(ContractAttributeValueSearchModel searchModel,
                                                                                                     ContractAttribute contractAttribute)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            if (contractAttribute == null)
            {
                throw new ArgumentNullException(nameof(contractAttribute));
            }

            searchModel.ContractAttributeId = contractAttribute.Id;

            searchModel.SetGridPageSize();

            return(searchModel);
        }
示例#3
0
        public virtual ContractAttributeValueListModel PrepareContractAttributeValueListModel(ContractAttributeValueSearchModel searchModel, ContractAttribute contractAttribute)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            if (contractAttribute == null)
            {
                throw new ArgumentNullException(nameof(contractAttribute));
            }

            var contractAttributeValues = _contractAttributeService.GetContractAttributeValues(contractAttribute.Id);

            var model = new ContractAttributeValueListModel
            {
                Data = contractAttributeValues.PaginationByRequestModel(searchModel)
                       .Select(value => value.ToModel <ContractAttributeValueModel>()),
                Total = contractAttributeValues.Count
            };

            return(model);
        }