public virtual IActionResult ManufacturerAddPopupList(AddManufacturerToDiscountSearchModel searchModel) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageDiscounts)) return AccessDeniedKendoGridJson(); //prepare model var model = _discountModelFactory.PrepareAddManufacturerToDiscountListModel(searchModel); return Json(model); }
/// <returns>A task that represents the asynchronous operation</returns> public virtual async Task <IActionResult> ManufacturerAddPopupList(AddManufacturerToDiscountSearchModel searchModel) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageDiscounts)) { return(await AccessDeniedDataTablesJson()); } //prepare model var model = await _discountModelFactory.PrepareAddManufacturerToDiscountListModelAsync(searchModel); return(Json(model)); }
/// <summary> /// Prepare paged manufacturer list model to add to the discount /// </summary> /// <param name="searchModel">Manufacturer search model to add to the discount</param> /// <returns>Manufacturer list model to add to the discount</returns> public virtual AddManufacturerToDiscountListModel PrepareAddManufacturerToDiscountListModel(AddManufacturerToDiscountSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get manufacturers var manufacturers = _manufacturerService.GetAllManufacturers(showHidden: true, manufacturerName: searchModel.SearchManufacturerName, pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize); //prepare grid model var model = new AddManufacturerToDiscountListModel().PrepareToGrid(searchModel, manufacturers, () => { return(manufacturers.Select(manufacturer => { var manufacturerModel = manufacturer.ToModel <ManufacturerModel>(); manufacturerModel.SeName = _urlRecordService.GetSeName(manufacturer, 0, true, false); return manufacturerModel; })); }); return(model); }
/// <summary> /// Prepare manufacturer search model to add to the discount /// </summary> /// <param name="searchModel">Manufacturer search model to add to the discount</param> /// <returns>Manufacturer search model to add to the discount</returns> public virtual AddManufacturerToDiscountSearchModel PrepareAddManufacturerToDiscountSearchModel(AddManufacturerToDiscountSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare page parameters searchModel.SetPopupGridPageSize(); return(searchModel); }
/// <summary> /// Prepare paged manufacturer list model to add to the discount /// </summary> /// <param name="searchModel">Manufacturer search model to add to the discount</param> /// <returns>Manufacturer list model to add to the discount</returns> public virtual AddManufacturerToDiscountListModel PrepareAddManufacturerToDiscountListModel(AddManufacturerToDiscountSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get manufacturers var manufacturers = _manufacturerService.GetAllManufacturers(showHidden: true, manufacturerName: searchModel.SearchManufacturerName, pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize); //prepare grid model var model = new AddManufacturerToDiscountListModel { //fill in model values from the entity Data = manufacturers.Select(manufacturer => manufacturer.ToModel <ManufacturerModel>()), Total = manufacturers.TotalCount }; return(model); }
/// <summary> /// Prepare manufacturer search model to add to the discount /// </summary> /// <param name="searchModel">Manufacturer search model to add to the discount</param> /// <returns> /// A task that represents the asynchronous operation /// The task result contains the manufacturer search model to add to the discount /// </returns> public virtual Task <AddManufacturerToDiscountSearchModel> PrepareAddManufacturerToDiscountSearchModelAsync(AddManufacturerToDiscountSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare page parameters searchModel.SetPopupGridPageSize(); return(Task.FromResult(searchModel)); }