private async System.Threading.Tasks.Task RemoveProductAttributesAsync() { var productAttributes = (await _productAttributeService.GetAllProductAttributesAsync()) .Where(pa => pa.Name == AbcMattressesConsts.MattressSizeName || AbcMattressesConsts.IsBase(pa.Name) || AbcMattressesConsts.IsMattressProtector(pa.Name) || AbcMattressesConsts.IsFrame(pa.Name) || pa.Name == AbcMattressesConsts.FreeGiftName) .ToList(); await _productAttributeService.DeleteProductAttributesAsync(productAttributes); }
/// <returns>A task that represents the asynchronous operation</returns> public virtual async Task <IActionResult> DeleteSelected(ICollection <int> selectedIds) { if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageAttributes)) { return(AccessDeniedView()); } if (selectedIds != null) { var productAttributes = await _productAttributeService.GetProductAttributeByIdsAsync(selectedIds.ToArray()); await _productAttributeService.DeleteProductAttributesAsync(productAttributes); foreach (var productAttribute in productAttributes) { await _customerActivityService.InsertActivityAsync("DeleteProductAttribute", string.Format(await _localizationService.GetResourceAsync("ActivityLog.DeleteProductAttribute"), productAttribute.Name), productAttribute); } } return(Json(new { Result = true })); }