예제 #1
0
        static internal void HardcodeAuctions()
        {
            AuctionItem p1 = new AuctionItem(1, "Brugt cykel", 1000.00M, 500.00M, "Daniel Alexander Nedergaard", 12345678, DateTime.Now);
            AuctionItem p2 = new AuctionItem(2, "Smart ny bil", 50000.00M, 75000.00M, "Bjørk", 87654321, DateTime.Now);

            AuctionHouseData.AddAuction(p1);
            AuctionHouseData.AddAuction(p2);
        }
        internal static List <AuctionItem> GetAllAuctions()
        {
            if (AuctionList.Count == 0)
            {
                AuctionItem.HardcodeAuctions();
            }

            return(AuctionList);
        }
        internal static AuctionItem GetAuction(int itemNumber)
        {
            if (AuctionList.Count == 0)
            {
                AuctionItem.HardcodeAuctions();
            }

            lock (myLock)
            {
                foreach (var item in AuctionList)
                {
                    if (item.ItemNumber == itemNumber)
                    {
                        return(item);
                    }
                }
            }

            return(null);
        }
 internal static void AddAuction(AuctionItem p)
 {
     AuctionList.Add(p);
 }