public MyBidItem(Service service, Guid userId) { if (service == null) throw new ArgumentException("service cannot be null or whitespace"); _serviceId = service.Id; _highestBid = service .LatestBids() .Max(o => o.Amount); _myHighestBid = service.LatestBidForUser(userId).Amount; _reference = service.Reference; _isCompleted = service.BiddingCompletionDate<DateTime.Now; if (service.AcceptedBid!=null && !service.AcceptedBid.IsCancelled) { if (service.AcceptedBid.Bid.UserId == userId) _status = "Successful"; else _status = "Unsuccessful"; } else _status = "To be accepted!"; _estimatedServiceDue = service.ServiceDue; _biddingCompletion = service.BiddingCompletionDate; }
public BidAcceptanceViewModel(Service service) { _serviceViewModel = new ServiceViewModel(service); if (service != null) { FinalServiceProviderBidViewModels = service .LatestBids().Select(o => new FinalServiceProviderBidViewModel(o)).ToList(); } else FinalServiceProviderBidViewModels = new List<FinalServiceProviderBidViewModel>(); }