コード例 #1
0
        public IActionResult RateUpdate(ShippingByTotalModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings))
            {
                return(AccessDeniedKendoGridJson());
            }

            var shippingByTotalRecord = _shippingByTotalService.GetShippingByTotalRecordById(model.Id);

            shippingByTotalRecord.ZipPostalCode            = model.ZipPostalCode == "*" ? null : model.ZipPostalCode;
            shippingByTotalRecord.DisplayOrder             = model.DisplayOrder;
            shippingByTotalRecord.From                     = model.From;
            shippingByTotalRecord.To                       = model.To;
            shippingByTotalRecord.UsePercentage            = model.UsePercentage;
            shippingByTotalRecord.ShippingChargePercentage = model.UsePercentage ? model.ShippingChargePercentage : 0;
            shippingByTotalRecord.ShippingChargeAmount     = !model.UsePercentage ? model.ShippingChargeAmount : 0;
            shippingByTotalRecord.ShippingMethodId         = model.ShippingMethodId;
            shippingByTotalRecord.StoreId                  = model.StoreId;
            shippingByTotalRecord.WarehouseId              = model.WarehouseId;
            shippingByTotalRecord.StateProvinceId          = model.StateProvinceId;
            shippingByTotalRecord.CountryId                = model.CountryId;
            _shippingByTotalService.UpdateShippingByTotalRecord(shippingByTotalRecord);

            return(new NullJsonResult());
        }
コード例 #2
0
        public ActionResult RateUpdate(ShippingByTotalModel model, GridCommand command)
        {
            if (!ModelState.IsValid)
            {
                return(new JsonResult {
                    Data = "error"
                });
            }

            var shippingByTotalRecord = _shippingByTotalService.GetShippingByTotalRecordById(model.Id);

            shippingByTotalRecord.Zip                      = model.Zip == "*" ? null : model.Zip;
            shippingByTotalRecord.From                     = model.From;
            shippingByTotalRecord.To                       = model.To;
            shippingByTotalRecord.UsePercentage            = model.UsePercentage;
            shippingByTotalRecord.ShippingChargeAmount     = model.ShippingChargeAmount;
            shippingByTotalRecord.ShippingChargePercentage = model.ShippingChargePercentage;
            shippingByTotalRecord.BaseCharge               = model.BaseCharge;
            shippingByTotalRecord.MaxCharge                = model.MaxCharge;
            _shippingByTotalService.UpdateShippingByTotalRecord(shippingByTotalRecord);

            return(RatesList(command));
        }