Exemplo n.º 1
0
        public Product GetProduct(string listingId, string productId)
        {
            Product product = Listings.Find(l => l.ID.Equals(listingId) || l.Name.Equals(listingId)).Products.Where(p => p.ProductID.Equals(productId)).First();

            if (product == null)
            {
                Console.WriteLine("Product with listing identifier {0} and product id {1} does not exist.", listingId, productId);
            }
            return(product);
        }
Exemplo n.º 2
0
        public void AddListing(Listing listing)
        {
            Listing duplicate = Listings.Find(li => li.ID.Equals(listing.ID));

            if (duplicate != null)
            {
                Console.WriteLine("Listing not added. Trying to add listing with duplicate ID. Did you mean to update?");
                Console.WriteLine("Conflicting Materials:\nName: {0} ID: {1}\nName: {2} ID: {3}", listing.Name, listing.ID, duplicate.Name, duplicate.ID);
                return;
            }
            Listings.Add(listing);
        }
Exemplo n.º 3
0
 public Listing GetListing(Predicate <Listing> match)
 {
     return(Listings.Find(match));
 }