public Holding Add(string classification, int branchId) { var material = ClassificationService.Retrieve(classification); if (material == null) { throw new LibraryException("Invalid classification"); } var copyNumber = Holdings.Count(classification) + 1; var holding = new Holding(classification, copyNumber, branchId) { CheckoutPolicy = material.CheckoutPolicy }; Holdings.Add(classification, holding); return(holding); }
public Holding Retrieve(string barcode) { var classification = Holding.ClassificationFromBarcode(barcode); return(Holdings[classification].Where(x => x.Barcode == barcode).FirstOrDefault()); // ?DO: create Holdings collection, implement iterable }