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); } }
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); }