1. 26.
    0
    [AcceptVerbs(HttpVerbs. Post)]
    [HttpPost, GridAction(EnableCustomBinding = true)]
    public ActionResult BulkEditSave(GridCommand command,
    [Bind(Prefix = "updated")]IEnumerable<BulkEditProductVariantModel> updatedProductVariants,
    [Bind(Prefix = "deleted")]IEnumerable<BulkEditProductVariantModel> deletedProductVariants,
    BulkEditListModel model)
    {
    if (!_permissionService. Authorize(StandardPermissionProvider. ManageCatalog))
    return AccessDeniedView();

    if (updatedProductVariants != null)
    {
    foreach (var pvModel in updatedProductVariants)
    {
    //update
    var pv = _productService. GetProductVariantById(pvModel.Id);
    if (pv != null)
    {
    pv.Sku = pvModel.Sku;
    pv.Price = pvModel. Price;
    pv.OldPrice = pvModel. OldPrice;
    pv.Published = pvModel. Published;
    _productService. UpdateProductVariant(pv);
    }
    }
    }
    if (deletedProductVariants != null)
    {
    foreach (var pvModel in deletedProductVariants)
    {
    //delete
    var pv = _productService. GetProductVariantById(pvModel.Id);
    if (pv != null)
    _productService. DeleteProductVariant(pv);
    }
    }
    return BulkEditSelect(command, model);
    }
    ···
   tümünü göster