Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
using Grand.Data;
using Grand.Domain.Catalog;
using Grand.Domain.Directory;
using Grand.Infrastructure.Events;
using Grand.Mediator;
namespace Grand.Business.Catalog.Events.Handlers;
public class DeleteMeasureUnitOnProductEventHandler : INotificationHandler<EntityDeleted<MeasureUnit>>
{
private readonly IRepository<Product> _repositoryProduct;
public DeleteMeasureUnitOnProductEventHandler(IRepository<Product> repositoryProduct)
{
_repositoryProduct = repositoryProduct;
}
public async Task Handle(EntityDeleted<MeasureUnit> notification, CancellationToken cancellationToken)
{
await _repositoryProduct.UpdateManyAsync(x => x.UnitId == notification.Entity.Id,
UpdateBuilder<Product>.Create().Set(x => x.UnitId, ""));
}
}