public WinningBidSnapshot GetSnapshot() { var snapshot = new WinningBidSnapshot(); snapshot.BiddersId = this.Bidder; snapshot.BiddersMaximumBid = this.MaximumBid.GetSnapshot().Value; snapshot.CurrentPrice = this.CurrentAuctionPrice.Amount.GetSnapshot().Value; snapshot.TimeOfBid = this.TimeOfBid; return(snapshot); }
public Auction FindBy(Guid Id) { var auctionDTO = _auctionExampleContext.Auctions.Find(Id); var auctionSnapshot = new AuctionSnapshot(); auctionSnapshot.Id = auctionDTO.Id; auctionSnapshot.EndsAt = auctionDTO.AuctionEnds; auctionSnapshot.StartingPrice = auctionDTO.StartingPrice; auctionSnapshot.Version = auctionDTO.Version; if (auctionDTO.BidderMemberId.HasValue) { var bidSnapshot = new WinningBidSnapshot(); bidSnapshot.BiddersMaximumBid = auctionDTO.MaximumBid.Value; bidSnapshot.CurrentPrice = auctionDTO.CurrentPrice.Value; bidSnapshot.BiddersId = auctionDTO.BidderMemberId.Value; bidSnapshot.TimeOfBid = auctionDTO.TimeOfBid.Value; auctionSnapshot.WinningBid = bidSnapshot; } return Auction.CreateFrom(auctionSnapshot); }
public static WinningBid CreateFrom(WinningBidSnapshot bidSnapShot) { return(new WinningBid(bidSnapShot.BiddersId, new Money(bidSnapShot.BiddersMaximumBid), new Money(bidSnapShot.CurrentPrice), bidSnapShot.TimeOfBid)); }