private Auction(AuctionSnapshot snapshot) { this.Id = snapshot.Id; this.StartingPrice = new Money(snapshot.StartingPrice); this.EndsAt = snapshot.EndsAt; this.Version = snapshot.Version; if (snapshot.WinningBid != null) { CurrentWinningBid = WinningBid.CreateFrom(snapshot.WinningBid); } }
public AuctionSnapshot GetSnapshot() { var snapshot = new AuctionSnapshot(); snapshot.Id = this.Id; snapshot.StartingPrice = this.StartingPrice.GetSnapshot().Value; snapshot.EndsAt = this.EndsAt; snapshot.Version = this.Version; if (HasACurrentBid()) { snapshot.WinningBid = CurrentWinningBid.GetSnapshot(); } return(snapshot); }
public static Auction CreateFrom(AuctionSnapshot snapshot) { return(new Auction(snapshot)); }