Exemplo n.º 1
0
 public void CreateShop(int id, string name)
 {
     if (!Shops.TryGetValue(id, out var outShop))
     {
         var shop = new Shop(id, name);
         Shops.Add(shop.Id, shop);
     }
 }
Exemplo n.º 2
0
        public void CreateProduct(string name, double price, int count, int shopId)
        {
            var product = new Product(name, price, count)
            {
                ShopId = shopId
            };

            if (Shops.TryGetValue(shopId, out var shop))
            {
                product.Shop = shop;
            }
            else
            {
                throw new ShopNotFoundException();
            }
            Products.Add(product);
        }