예제 #1
0
 public TemplatesModel()
 {
     TemplatesCategory     = new CategoryTemplateSearchModel();
     TemplatesManufacturer = new ManufacturerTemplateSearchModel();
     TemplatesProduct      = new ProductTemplateSearchModel();
     TemplatesTopic        = new TopicTemplateSearchModel();
 }
예제 #2
0
        public virtual IActionResult ManufacturerTemplates(ManufacturerTemplateSearchModel searchModel)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance))
            {
                return(AccessDeniedDataTablesJson());
            }

            //prepare model
            var model = _templateModelFactory.PrepareManufacturerTemplateListModel(searchModel);

            return(Json(model));
        }
        /// <summary>
        /// Prepare paged manufacturer template list model
        /// </summary>
        /// <param name="searchModel">Manufacturer template search model</param>
        /// <returns>Manufacturer template list model</returns>
        public virtual ManufacturerTemplateListModel PrepareManufacturerTemplateListModel(ManufacturerTemplateSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get manufacturer templates
            var manufacturerTemplates = _manufacturerTemplateService.GetAllManufacturerTemplates().ToPagedList(searchModel);

            //prepare grid model
            var model = new ManufacturerTemplateListModel().PrepareToGrid(searchModel, manufacturerTemplates,
                                                                          () => manufacturerTemplates.Select(template => template.ToModel <ManufacturerTemplateModel>()));

            return(model);
        }
        /// <summary>
        /// Prepare manufacturer template search model
        /// </summary>
        /// <param name="searchModel">Manufacturer template search model</param>
        /// <returns>Manufacturer template search model</returns>
        public virtual ManufacturerTemplateSearchModel PrepareManufacturerTemplateSearchModel(ManufacturerTemplateSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //prepare page parameters
            searchModel.SetGridPageSize();

            return(searchModel);
        }
예제 #5
0
        /// <summary>
        /// Prepare manufacturer template search model
        /// </summary>
        /// <param name="searchModel">Manufacturer template search model</param>
        /// <returns>Manufacturer template search model</returns>
        protected virtual Task <ManufacturerTemplateSearchModel> PrepareManufacturerTemplateSearchModelAsync(ManufacturerTemplateSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //prepare page parameters
            searchModel.SetGridPageSize();

            return(Task.FromResult(searchModel));
        }
예제 #6
0
        /// <summary>
        /// Prepare paged manufacturer template list model
        /// </summary>
        /// <param name="searchModel">Manufacturer template search model</param>
        /// <returns>Manufacturer template list model</returns>
        public virtual ManufacturerTemplateListModel PrepareManufacturerTemplateListModel(ManufacturerTemplateSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //get manufacturer templates
            var manufacturerTemplates = _manufacturerTemplateService.GetAllManufacturerTemplates();

            //prepare grid model
            var model = new ManufacturerTemplateListModel
            {
                //fill in model values from the entity
                Data = manufacturerTemplates.PaginationByRequestModel(searchModel)
                       .Select(template => template.ToModel <ManufacturerTemplateModel>()),
                Total = manufacturerTemplates.Count
            };

            return(model);
        }