public BidInfoDTO(Bid bid) { BidId = bid.BidId; Bidder = new UserInfoDto(bid.Bidder); OnProductId = bid.OnProduct.ProductId; MadeAt = bid.MadeAt; BidAmount = bid.BidAmount; WinningBid = bid.WinningBid; }
public ProductDetailDTO(Product product, bool withBids = false) { ProductId = product.ProductId; Name = product.Name; CategoryEnum temp; if (Enum.TryParse(product.Category, out temp)) { Category = temp; } if (withBids) { Bids = product.Bids.Select(b => new BidInfoDTO(b)).ToList(); } BidCount = product.Bids.Count; CurrentPrice = BidCount == 0 ? product.MinimumBid : product.Bids.Max(x => x.BidAmount); Seller = new UserInfoDto(product.Seller); Description = product.Description; MinimumBid = product.MinimumBid; BiddingStartTime = product.BiddingStartTime; BiddingEndTime = product.BiddingEndTime; }