public ActionResult ShippingRateUpdate(FixedRateModel model, GridCommand command) { int shippingMethodId = model.ShippingMethodId; decimal rate = model.Rate; if (shippingMethodId != 0) { _settingService.SetSetting(string.Format("ShippingRateComputationMethod.FixedRate.Rate.ShippingMethodId{0}", shippingMethodId), rate); } var tmp = new List <FixedRateModel>(); foreach (var shippingMethod in _shippingService.GetAllShippingMethods()) { tmp.Add(new FixedRateModel() { ShippingMethodId = shippingMethod.Id, ShippingMethodName = shippingMethod.Name, Rate = GetShippingRate(shippingMethod.Id) }); } var tmp2 = tmp.ForCommand(command); var gridModel = new GridModel <FixedRateModel> { Data = tmp2, Total = tmp2.Count() }; return(new JsonResult { Data = gridModel }); }
public IActionResult UpdateFixedShippingRate(FixedRateModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) { return(Content("Access denied")); } _settingService.SetSetting(string.Format(FixedByWeightByTotalDefaults.FixedRateSettingsKey, model.ShippingMethodId), model.Rate); return(new NullJsonResult()); }
public ActionResult UpdateFixedShippingRate(FixedRateModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) { return(Content("Access denied")); } var shippingMethodId = model.ShippingMethodId; var rate = model.Rate; _settingService.SetSetting(string.Format("ShippingRateComputationMethod.JD.Rate.ShippingMethodId{0}", shippingMethodId), rate); return(new NullJsonResult()); }
/// <returns>A task that represents the asynchronous operation</returns> public async Task <IActionResult> UpdateFixedShippingRate(FixedRateModel model) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageShippingSettings)) { return(Content("Access denied")); } await _settingService.SetSettingAsync(string.Format(FixedByWeightByTotalDefaults.FixedRateSettingsKey, model.ShippingMethodId), model.Rate, 0, false); await _settingService.SetSettingAsync(string.Format(FixedByWeightByTotalDefaults.TransitDaysSettingsKey, model.ShippingMethodId), model.TransitDays, 0, false); await _settingService.ClearCacheAsync(); return(new NullJsonResult()); }