public ActionResult AddTaxRate(TaxRateListModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings)) return Content("Access denied"); var taxRate = new TaxRate() { TaxCategoryId = model.AddTaxCategoryId, CountryId = model.AddCountryId, StateProvinceId = model.AddStateProvinceId, Zip = model.AddZip, Percentage = model.AddPercentage }; _taxRateService.InsertTaxRate(taxRate); return Json(new { Result = true }); }
public ActionResult Configure() { var taxCategories = _taxCategoryService.GetAllTaxCategories(); if (taxCategories.Count == 0) return Content("No tax categories can be loaded"); var model = new TaxRateListModel(); //tax categories foreach (var tc in taxCategories) model.AvailableTaxCategories.Add(new SelectListItem() { Text = tc.Name, Value = tc.Id.ToString() }); //countries var countries = _countryService.GetAllCountries(true); foreach (var c in countries) model.AvailableCountries.Add(new SelectListItem() { Text = c.Name, Value = c.Id.ToString() }); //states model.AvailableStates.Add(new SelectListItem() { Text = "*", Value = "0" }); var states = _stateProvinceService.GetStateProvincesByCountryId(countries.FirstOrDefault().Id); foreach (var s in states) model.AvailableStates.Add(new SelectListItem() { Text = s.Name, Value = s.Id.ToString() }); return View("Nas.Plugin.Tax.CountryStateZip.Views.TaxCountryStateZip.Configure", model); }