Skip to content

Instantly share code, notes, and snippets.

@explorer14
Last active November 17, 2018 18:23
Show Gist options
  • Save explorer14/f7d6754fe8a3a54a3730ad5d441535f7 to your computer and use it in GitHub Desktop.
Save explorer14/f7d6754fe8a3a54a3730ad5d441535f7 to your computer and use it in GitHub Desktop.
namespace Domain
{
public class UseCase
{
private readonly IPublisher _publisher;
private readonly IRetrieveProducts _productsRetriever;
public UseCase(
IPublisher publisher,
IRetrieveProducts productsRetriever)
{
_publisher = publisher;
_productsRetriever = productsRetriever;
}
public async Task Run()
{
var products = await _productsRetriever.Get();
foreach (var product in products)
{
product.CalculateReorderLevel();
await _publisher.Publish(product);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment