// Add New Seller Market Entry to Auction public void AddSellerMarketEntry(MarketEntryFormViewModel viewModel, string userId) { var marketEntry = MarketEntry.CreateSellerEntry(userId, EntryType.Supply, Id, viewModel.FinalProductId, viewModel.EntryQuantity, viewModel.EntryPrice, viewModel.DeliveryDate); MarketEntries.Add(marketEntry); }
// Add New Buyer Market Entry to Auction public void AddBuyerMarketEntry(MarketEntryFormViewModel viewModel, string userId) { var marketEntry = MarketEntry.CreateBuyerEntry(userId, EntryType.Demand, Id, viewModel.ProductId, viewModel.ProductQualityId, viewModel.EntryQuantity, viewModel.EntryPrice, viewModel.DeliveryDate, viewModel.DeliveryLocation); MarketEntries.Add(marketEntry); }
// Static Factory Method - Create Seller Entry public static MarketEntry CreateSellerEntry(string userId, EntryType entryType, int auctionId, int finalProductId, double entryQuantity, decimal entryPrice, DateTime deliveryDate) { var marketEntry = new MarketEntry(userId, entryType, auctionId, entryQuantity, entryPrice, deliveryDate); marketEntry.SetFinalProduct(finalProductId); return(marketEntry); }
// * Methods * // Static Factory Method - Create Buyer Entry public static MarketEntry CreateBuyerEntry(string userId, EntryType entryType, int auctionId, int productId, byte productQualityId, double entryQuantity, decimal entryPrice, DateTime deliveryDate, string deliveryLocation) { var marketEntry = new MarketEntry(userId, entryType, auctionId, entryQuantity, entryPrice, deliveryDate); var buyerFinalProduct = new FinalProduct() { ProductId = productId, QualityId = productQualityId }; marketEntry.FinalProduct = buyerFinalProduct; marketEntry.DeliveryLocation = deliveryLocation; return(marketEntry); }