/// <summary>
        /// Prepare store pickup point list model
        /// </summary>
        /// <param name="searchModel">Store pickup point search model</param>
        /// <returns>Store pickup point list model</returns>
        public StorePickupPointListModel PrepareStorePickupPointListModel(StorePickupPointSearchModel searchModel)
        {
            var pickupPoints = _storePickupPointService.GetAllStorePickupPoints(pageIndex: searchModel.Page - 1,
                                                                                pageSize: searchModel.PageSize);
            var model = new StorePickupPointListModel().PrepareToGrid(searchModel, pickupPoints, () =>
            {
                return(pickupPoints.Select(point =>
                {
                    var store = _storeService.GetStoreById(point.StoreId);
                    return new StorePickupPointModel
                    {
                        Id = point.Id,
                        Name = point.Name,
                        OpeningHours = point.OpeningHours,
                        PickupFee = point.PickupFee,
                        DisplayOrder = point.DisplayOrder,
                        StoreName = store?.Name ?? (point.StoreId == 0
                                        ? _localizationService.GetResource(
                                                        "Admin.Configuration.Settings.StoreScope.AllStores")
                                        : string.Empty)
                    };
                }));
            });

            return(model);
        }
Example #2
0
        /// <summary>
        /// Prepare store pickup point search model
        /// </summary>
        /// <param name="searchModel">Store pickup point search model</param>
        /// <returns>Store pickup point search model</returns>
        public StorePickupPointSearchModel PrepareStorePickupPointSearchModel(StorePickupPointSearchModel searchModel)
        {
            if (searchModel == null)
                throw new ArgumentNullException(nameof(searchModel));

            //prepare page parameters
            searchModel.SetGridPageSize();

            return searchModel;
        }
        /// <returns>A task that represents the asynchronous operation</returns>
        public async Task <IActionResult> List(StorePickupPointSearchModel searchModel)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageShippingSettings))
            {
                return(await AccessDeniedDataTablesJson());
            }

            //prepare model
            var model = await _storePickupPointModelFactory.PrepareStorePickupPointListModelAsync(searchModel);

            return(Json(model));
        }
Example #4
0
        /// <summary>
        /// Prepare store pickup point search model
        /// </summary>
        /// <param name="searchModel">Store pickup point search model</param>
        /// <returns>
        /// A task that represents the asynchronous operation
        /// The task result contains the store pickup point search model
        /// </returns>
        public Task <StorePickupPointSearchModel> PrepareStorePickupPointSearchModelAsync(StorePickupPointSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            //prepare page parameters
            searchModel.SetGridPageSize();

            return(Task.FromResult(searchModel));
        }