Beispiel #1
0
        public static bool SetSizeInventory(List <pi.Size> sizes, int locationId, int stock)
        {
            foreach (var size in sizes)
            {
                var dataSize = new SizeInventory()
                {
                    SizeId     = size.SizeId,
                    LocationId = locationId,
                    Stock      = stock
                };

                _db.SizeInventory.Add(dataSize);
            }

            return(_db.SaveChanges() == 4);
        }
Beispiel #2
0
        public static void InitLocationInventory(int locationId)
        {
            var crusts       = GetCrusts();
            var sizes        = GetSizes();
            var toppings     = GetToppings();
            var defaultStock = 10;

            foreach (var crust in crusts)
            {
                var dataCrust = new CrustInventory()
                {
                    CrustId    = crust.CrustId,
                    LocationId = locationId,
                    Stock      = defaultStock
                };

                _db.CrustInventory.Add(dataCrust);
            }

            foreach (var size in sizes)
            {
                var dataSize = new SizeInventory()
                {
                    SizeId     = size.SizeId,
                    LocationId = locationId,
                    Stock      = defaultStock
                };

                _db.SizeInventory.Add(dataSize);
            }

            foreach (var topping in toppings)
            {
                var dataTopping = new ToppingInventory()
                {
                    ToppingId  = topping.ToppingId,
                    LocationId = locationId,
                    Stock      = defaultStock
                };

                _db.ToppingInventory.Add(dataTopping);
            }
        }