public async Task <Unit> Handle(StaticMeshPatchCommand request, CancellationToken cancellationToken) { var canOperate = await clientAssetPermissionControlService.CanEditClientAsset(); if (!canOperate) { throw new HttpForbiddenException(); } var staticMesh = await staticMeshRepository.FindAsync(request.Id); if (staticMesh == null) { throw new HttpResourceNotFoundException(commonLocalizer["HttpRespond.NotFound", "StaticMesh", request.Id]); } mapper.Map(staticMesh, request); request.ApplyPatch(); var modifier = identityService.GetUserId(); staticMesh.UpdateBasicInfo(request.Name, modifier); await staticMeshRepository.UpdateAsync(staticMesh); return(Unit.Value); }
public async Task Handle(ProductSpecCreatedEvent notification, CancellationToken cancellationToken) { if (string.IsNullOrWhiteSpace(notification.SourcedStaticMeshId)) { return; } var mesh = await staticMeshRepository.FindAsync(notification.SourcedStaticMeshId); mesh.SignRelatedProductSpec(notification.Id); await staticMeshRepository.UpdateAsync(mesh); }