Beispiel #1
0
        public AuctionListViewModel(Domain.DomainClasses.Auction auction)
        {
            AuctionId   = auction.Id;
            ProductName = auction.Product.Name;
            TotalBids   = auction.Bids.Count;
            var winningBid = auction.Bids.OrderBy(b => b.Amount).LastOrDefault();

            CurrentPrice = winningBid != null
                ? winningBid.Amount
                : auction.Product.GetStartPrice();
            AcceptedPrice = auction.AcceptedPrice;
            EndTime       = auction.EndTime;
        }
Beispiel #2
0
        public ShowAuctionViewModel(Domain.DomainClasses.Auction auction)
        {
            AuctionId   = auction.Id;
            ProductName = auction.Product.Name;
            TotalBid    = auction.Bids.Count;
            var winningBid = auction.Bids.OrderBy(b => b.Amount).LastOrDefault();

            if (winningBid != null)
            {
                WinningBid = winningBid.Amount;
            }
            StartPrice    = auction.Product.GetStartPrice();
            AcceptedPrice = auction.AcceptedPrice;
            StartDate     = auction.StartTime;
            EndDate       = auction.EndTime;
            Bids          = auction.Bids.Select(b => new BidViewModel(b)).ToList();
        }
Beispiel #3
0
 public AuctionViewModel(Domain.DomainClasses.Auction auction) : base(auction)
 {
 }
Beispiel #4
0
 public void AddAuction(Domain.DomainClasses.Auction auction)
 {
     auction.Product = _db.Products.First(p => auction.Product.Id == p.Id);
     _db.Auctions.Add(auction);
     Update();
 }