public ActionResult AddShippingByWeightRecord(ShippingByWeightListModel model)
        {
            if (!ModelState.IsValid)
            {
                return Configure();
            }

            var sbw = new ShippingByWeightRecord()
            {
                StoreId = model.AddStoreId,
                ShippingMethodId = model.AddShippingMethodId,
                CountryId = model.AddCountryId,
                Zip = model.AddZip,
                //StateProvinceId = 0,
                From = model.AddFrom,
                To = model.AddTo,
                UsePercentage = model.AddUsePercentage,
                ShippingChargeAmount = model.AddShippingChargeAmount,
                ShippingChargePercentage = model.AddShippingChargePercentage,
                SmallQuantitySurcharge = model.SmallQuantitySurcharge,
                SmallQuantityThreshold = model.SmallQuantityThreshold,
            };
            _shippingByWeightService.InsertShippingByWeightRecord(sbw);

            return Configure();
        }
        public ActionResult Configure()
        {
            var shippingMethods = _shippingService.GetAllShippingMethods();
            if (shippingMethods.Count == 0)
                return Content("No shipping methods can be loaded");

            var model = new ShippingByWeightListModel();
            foreach (var sm in shippingMethods)
                model.AvailableShippingMethods.Add(new SelectListItem() { Text = sm.Name, Value = sm.Id.ToString() });

			//stores
			model.AvailableStores.Add(new SelectListItem() { Text = "*", Value = "0" });
			foreach (var store in _storeService.GetAllStores())
				model.AvailableStores.Add(new SelectListItem() { Text = store.Name, Value = store.Id.ToString() });

            model.AvailableCountries.Add(new SelectListItem() { Text = "*", Value = "0" });
            var countries = _countryService.GetAllCountries(true);
            foreach (var c in countries)
                model.AvailableCountries.Add(new SelectListItem() { Text = c.Name, Value = c.Id.ToString() });
            model.LimitMethodsToCreated = _shippingByWeightSettings.LimitMethodsToCreated;
            model.CalculatePerWeightUnit = _shippingByWeightSettings.CalculatePerWeightUnit;
            model.PrimaryStoreCurrencyCode = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode;
            model.BaseWeightIn = _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId).Name;
			model.GridPageSize = _adminAreaSettings.GridPageSize;

            return View(model);
        }
        public ActionResult SaveGeneralSettings(ShippingByWeightListModel model)
        {
            //save settings
            _shippingByWeightSettings.LimitMethodsToCreated = model.LimitMethodsToCreated;
            _shippingByWeightSettings.CalculatePerWeightUnit = model.CalculatePerWeightUnit;
            _services.Settings.SaveSetting(_shippingByWeightSettings);

            return Configure();
        }