public ActionResult UpdateTaxCategoryMapping(WB_TaxCategoryMappingModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings)) { return(Content("Access denied")); } var taxCategoryMapping = _taxCategoryMappingService.GetTaxCategoryMappingById(model.Id); taxCategoryMapping.CategoryId = model.CategoryId; taxCategoryMapping.Percentage = model.Percentage; taxCategoryMapping.TaxCategoryId = model.TaxCategoryId; _taxCategoryMappingService.UpdateTaxCategoryMapping(taxCategoryMapping); return(new NullJsonResult()); }
public ActionResult TaxCategoryMappingList(DataSourceRequest command) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings)) { return(ErrorForKendoGridJson("Access denied")); } var records = _taxCategoryMappingService.GetAllTaxCategoryMappings(command.Page - 1, command.PageSize); var taxCategoryMappingsModel = records .Select(x => { var m = new WB_TaxCategoryMappingModel { Id = x.Id, StoreId = x.StoreId, TaxCategoryId = x.TaxCategoryId, CategoryId = x.CategoryId, 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 = _categoryService.GetCategoryById(x.CategoryId); m.CategoryName = c != null ? c.GetFormattedBreadCrumb(_categoryService, ">>") : "Unavailable"; return(m); }).ToList(); var gridModel = new DataSourceResult { Data = taxCategoryMappingsModel, Total = records.TotalCount }; return(Json(gridModel)); }