Last active
November 17, 2018 18:23
-
-
Save explorer14/f7d6754fe8a3a54a3730ad5d441535f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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