Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public static Auction CreateFrom(AuctionSnapshot snapshot)
 {
     return(new Auction(snapshot));
 }