public ActionResult UpdateRateByCountryStateZip(WB_CountryStateZipModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings)) { return(Content("Access denied")); } var taxRate = _taxRateService.GetTaxRateById(model.Id); taxRate.Zip = model.Zip == "*" ? null : model.Zip; taxRate.Percentage = model.Percentage; _taxRateService.UpdateTaxRate(taxRate); return(new NullJsonResult()); }
public ActionResult RatesByCountryStateZipList(DataSourceRequest command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings)) { return(ErrorForKendoGridJson("Access denied")); } var records = _taxRateService.GetAllTaxRates(command.Page - 1, command.PageSize); var taxRatesModel = records .Select(x => { var m = new WB_CountryStateZipModel { Id = x.Id, StoreId = x.StoreId, TaxCategoryId = x.TaxCategoryId, CountryId = x.CountryId, StateProvinceId = x.StateProvinceId, Zip = x.Zip, Percentage = x.Percentage }; //store var store = _storeService.GetStoreById(x.StoreId); m.StoreName = store != null ? store.Name : "*"; //tax category var tc = _taxCategoryService.GetTaxCategoryById(x.TaxCategoryId); m.TaxCategoryName = tc != null ? tc.Name : ""; //country var c = _countryService.GetCountryById(x.CountryId); m.CountryName = c != null ? c.Name : "Unavailable"; //state var s = _stateProvinceService.GetStateProvinceById(x.StateProvinceId); m.StateProvinceName = s != null ? s.Name : "*"; //zip m.Zip = !string.IsNullOrEmpty(x.Zip) ? x.Zip : "*"; return(m); }).ToList(); var gridModel = new DataSourceResult { Data = taxRatesModel, Total = records.TotalCount }; return(Json(gridModel)); }