public virtual IActionResult List(ProductAttributeSearchModel searchModel) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageAttributes)) { return(AccessDeniedKendoGridJson()); } //prepare model var model = _productAttributeModelFactory.PrepareProductAttributeListModel(searchModel); return(Json(model)); }
/// <returns>A task that represents the asynchronous operation</returns> public virtual async Task <IActionResult> List(ProductAttributeSearchModel searchModel) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageAttributes)) { return(await AccessDeniedDataTablesJson()); } //prepare model var model = await _productAttributeModelFactory.PrepareProductAttributeListModelAsync(searchModel); return(Json(model)); }
/// <summary> /// Prepare paged product attribute list model /// </summary> /// <param name="searchModel">Product attribute search model</param> /// <returns>Product attribute list model</returns> public virtual ProductAttributeListModel PrepareProductAttributeListModel(ProductAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get product attributes var productAttributes = _productAttributeService .GetAllProductAttributes(pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize); //prepare list model var model = new ProductAttributeListModel().PrepareToGrid(searchModel, productAttributes, () => { //fill in model values from the entity return(productAttributes.Select(attribute => attribute.ToModel <ProductAttributeModel>())); }); return(model); }
/// <summary> /// Prepare paged product attribute list model /// </summary> /// <param name="searchModel">Product attribute search model</param> /// <returns>Product attribute list model</returns> public virtual ProductAttributeListModel PrepareProductAttributeListModel(ProductAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get product attributes var productAttributes = _productAttributeService .GetAllProductAttributes(pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize); //prepare list model var model = new ProductAttributeListModel { //fill in model values from the entity Data = productAttributes.Select(attribute => attribute.ToModel()), Total = productAttributes.TotalCount }; return(model); }
/// <summary> /// Prepare product attribute search model /// </summary> /// <param name="searchModel">Product attribute search model</param> /// <returns>Product attribute search model</returns> public virtual ProductAttributeSearchModel PrepareProductAttributeSearchModel(ProductAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare page parameters searchModel.SetGridPageSize(); return(searchModel); }
/// <summary> /// Prepare product attribute search model /// </summary> /// <param name="searchModel">Product attribute search model</param> /// <returns>Product attribute search model</returns> public virtual Task <ProductAttributeSearchModel> PrepareProductAttributeSearchModelAsync(ProductAttributeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare page parameters searchModel.SetGridPageSize(); return(Task.FromResult(searchModel)); }