-
-
Save dcomartin/ffbb9e656902f53721f357e2d4773a45 to your computer and use it in GitHub Desktop.
This file contains 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
public class Basket : BaseEntity, IAggregateRoot | |
{ | |
private readonly List<BasketItem> _items = new List<BasketItem>(); | |
public string BuyerId { get; private set; } | |
public IReadOnlyCollection<BasketItem> Items => _items.AsReadOnly(); | |
public int TotalItems => _items.Sum(i => i.Quantity); | |
public Basket(string buyerId) | |
{ | |
BuyerId = buyerId; | |
} | |
// Rest of the code omitted | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment