public virtual TaskAttributeListModel PrepareTaskAttributeListModel(TaskAttributeSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            var taskAttributes = _taskAttributeService.GetAllTaskAttributes();

            var model = new TaskAttributeListModel
            {
                Data = taskAttributes.PaginationByRequestModel(searchModel).Select(attribute =>
                {
                    //fill in model values from the entity
                    var attributeModel = attribute.ToModel <TaskAttributeModel>();

                    //fill in additional values (not existing in the entity)
                    attributeModel.AttributeControlTypeName = _localizationService.GetLocalizedEnum(attribute.AttributeControlType);

                    return(attributeModel);
                }),
                Total = taskAttributes.Count
            };

            return(model);
        }
Esempio n. 2
0
        public virtual IActionResult List(TaskAttributeSearchModel searchModel)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
            {
                return(AccessDeniedKendoGridJson());
            }

            //prepare model
            var model = _taskAttributeModelFactory.PrepareTaskAttributeListModel(searchModel);

            return(Json(model));
        }
        public virtual TaskAttributeSearchModel PrepareTaskAttributeSearchModel(TaskAttributeSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //prepare page parameters
            searchModel.SetGridPageSize();

            return(searchModel);
        }
 public TaskAttributeSettingModel()
 {
     TaskAttributeSearchModel = new TaskAttributeSearchModel();
 }