using System.Collections.Generic; namespace AfterHours.Shop { /// /// Serverseitige Liste aller aktiven Lagerkisten, damit der SupplierService /// eine Lieferung der richtigen Kiste zuordnen kann. /// public sealed class StorageCrateRegistry { public static readonly StorageCrateRegistry Instance = new(); private readonly List _crates = new(); public void Register(StorageCrate crate) => _crates.Add(crate); public void Unregister(StorageCrate crate) => _crates.Remove(crate); /// Erste Kiste, die dieses Produkt führt. public StorageCrate FindFor(int productId) { foreach (var crate in _crates) if (crate != null && crate.ProductId == productId) return crate; return null; } } }