Esempio n. 1
0
 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;
 }
Esempio n. 2
0
        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;
        }