public async Task ProductActivityChangedAsync(ProductActivityChangedArgs args) { using (var scope = ServiceProvider.CreateScope()) { // Find the Product assoicated with the ProcessId var product = await ProductRepository.Get() .Where(p => p.Id == args.ProcessId) .Include(p => p.ProductDefinition) .Include(p => p.Project) .ThenInclude(pr => pr.Owner) .FirstOrDefaultAsync(); if (product == null) { Log.Error($"Could find Product for ProcessId={args.ProcessId}"); return; } var comment = await ReassignUserTasksForProduct(product); if (args.TransitionType == TransitionType.Rejection) { BackgroundJobClient.Enqueue <SendEmailService>(service => service.SendRejectEmail(product.Id, args, comment)); } } }
public void ProductActivityChanged(ProductActivityChangedArgs args) { ProductActivityChangedAsync(args).Wait(); }