public virtual IActionResult ProductAvailabilityRanges(ProductAvailabilityRangeSearchModel searchModel) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) { return(AccessDeniedKendoGridJson()); } //prepare model var model = _shippingModelFactory.PrepareProductAvailabilityRangeListModel(searchModel); return(Json(model)); }
public virtual async Task <IActionResult> ProductAvailabilityRanges(ProductAvailabilityRangeSearchModel searchModel) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageShippingSettings)) { return(await AccessDeniedDataTablesJson()); } //prepare model var model = await _shippingModelFactory.PrepareProductAvailabilityRangeListModelAsync(searchModel); return(Json(model)); }
/// <summary> /// Prepare paged product availability range list model /// </summary> /// <param name="searchModel">Product availability range search model</param> /// <returns>Product availability range list model</returns> public virtual ProductAvailabilityRangeListModel PrepareProductAvailabilityRangeListModel(ProductAvailabilityRangeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get product availability ranges var productAvailabilityRanges = _dateRangeService.GetAllProductAvailabilityRanges(); //prepare grid model var model = new ProductAvailabilityRangeListModel { //fill in model values from the entity Data = productAvailabilityRanges.PaginationByRequestModel(searchModel).Select(range => range.ToModel()), Total = productAvailabilityRanges.Count }; return(model); }
/// <summary> /// Prepare product availability range search model /// </summary> /// <param name="searchModel">Product availability range search model</param> /// <returns>Product availability range search model</returns> protected virtual ProductAvailabilityRangeSearchModel PrepareProductAvailabilityRangeSearchModel(ProductAvailabilityRangeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //prepare page parameters searchModel.SetGridPageSize(); return(searchModel); }
/// <summary> /// Prepare paged product availability range list model /// </summary> /// <param name="searchModel">Product availability range search model</param> /// <returns> /// A task that represents the asynchronous operation /// The task result contains the product availability range list model /// </returns> public virtual async Task <ProductAvailabilityRangeListModel> PrepareProductAvailabilityRangeListModelAsync(ProductAvailabilityRangeSearchModel searchModel) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } //get product availability ranges var productAvailabilityRanges = (await _dateRangeService.GetAllProductAvailabilityRangesAsync()).ToPagedList(searchModel); //prepare grid model var model = new ProductAvailabilityRangeListModel().PrepareToGrid(searchModel, productAvailabilityRanges, () => { //fill in model values from the entity return(productAvailabilityRanges.Select(range => range.ToModel <ProductAvailabilityRangeModel>())); }); return(model); }
public DatesRangesSearchModel() { DeliveryDateSearchModel = new DeliveryDateSearchModel(); ProductAvailabilityRangeSearchModel = new ProductAvailabilityRangeSearchModel(); }