/// <summary> /// Deletes the ShippingByTotalRecord /// </summary> /// <param name="shippingByTotalRecord">ShippingByTotalRecord</param> public virtual void DeleteShippingByTotalRecord(ShippingByTotalRecord shippingByTotalRecord) { if (shippingByTotalRecord == null) { throw new ArgumentNullException("shippingByTotalRecord"); } _sbtRepository.Delete(shippingByTotalRecord); _cacheManager.RemoveByPattern(SHIPPINGBYTOTAL_PATTERN_KEY); }
public ActionResult AddShippingRate(ShippingByTotalListModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) { return Json(new { Result = false, Message = _localizationService.GetResource("Plugins.Shipping.ByTotal.ManageShippingSettings.AccessDenied") }); } var zipPostalCode = model.AddZipPostalCode; if (zipPostalCode != null) { int zipMaxLength = ByTotalShippingComputationMethod.ZipPostalCodeMaxLength; zipPostalCode = zipPostalCode.Trim(); if (zipPostalCode.Length > zipMaxLength) { zipPostalCode = zipPostalCode.Substring(0, zipMaxLength); } } var shippingByTotalRecord = new ShippingByTotalRecord { ShippingMethodId = model.AddShippingMethodId, StoreId = model.AddStoreId, WarehouseId = model.AddWarehouseId, CountryId = model.AddCountryId, StateProvinceId = model.AddStateProvinceId, ZipPostalCode = zipPostalCode, DisplayOrder = model.AddDisplayOrder, From = model.AddFrom, To = model.AddTo, UsePercentage = model.AddUsePercentage, ShippingChargePercentage = (model.AddUsePercentage) ? model.AddShippingChargePercentage : 0, ShippingChargeAmount = (model.AddUsePercentage) ? 0 : model.AddShippingChargeAmount }; _shippingByTotalService.InsertShippingByTotalRecord(shippingByTotalRecord); return Json(new { Result = true }); }