コード例 #1
0
        public static void CreateBookInventoryItems(IInventoryRepository inventory, IArticleRepository articleRepo)
        {
            var book1 = articleRepo.FindArticleById(1);
            var book2 = articleRepo.FindArticleById(2);
            var book3 = articleRepo.FindArticleById(3);
            var book4 = articleRepo.FindArticleById(4);
            var book5 = articleRepo.FindArticleById(5);
            var book6 = articleRepo.FindArticleById(6);
            var book7 = articleRepo.FindArticleById(7);

            var sl1 = new StockLocation {
                Hall = "1", Corridor = "1", Rack = "1", Level = "1", Position = "1",
            };
            var sl2 = new StockLocation {
                Hall = "1", Corridor = "1", Rack = "1", Level = "1", Position = "2",
            };

            var inv1 = new InventoryItem
            {
                Id            = 1,
                Barcode       = "DDC8C0EC7E0B4EB094A058762AC38FE7",
                Article       = book1,
                PurchasedAt   = new DateTime(2016, 3, 20),
                Condition     = Condition.LikeNew,
                StockLocation = sl1
            };
            var inv2 = new InventoryItem
            {
                Id            = 2,
                Barcode       = "DC71308FA060404C847B87A1C9D18533",
                Article       = book1,
                PurchasedAt   = new DateTime(2016, 3, 20),
                Condition     = Condition.VeryGood,
                StockLocation = sl1
            };
            var inv3 = new InventoryItem
            {
                Id            = 3,
                Barcode       = "185CCEB1353E4C2A95894C540C756722",
                Article       = book2,
                PurchasedAt   = new DateTime(2016, 3, 20),
                Condition     = Condition.LikeNew,
                StockLocation = sl2
            };

            inventory.AddInventoryItems(new []
            {
                inv1,
                inv2,
                inv3,
            });
        }