public void AddSupplierToCategory(long supplier, Guid category) { if (Suppliers.ContainsKey(supplier)) { var categoryId = Suppliers[supplier]; if (CategoriesById.ContainsKey(categoryId)) { var c = GetCategoryByCategoryId(categoryId); c.Suppliers.Remove(supplier); } Suppliers[supplier] = category; } else { Suppliers.Add(supplier, category); } if (CategoriesById.ContainsKey(category)) { GetCategoryByCategoryId(category).Suppliers.Add(supplier); } OnCategoryUpdated(GetCategoryByCategoryId(category), supplier); }
public static Guid GetCategoryBySupplier(long supplierId) { if (Suppliers.ContainsKey(supplierId)) { return(Suppliers[supplierId]); } return(Guid.Empty); }