Beispiel #1
0
        public TeamsController(Ch2CContext context)
        {
            _context = context;
            var c = (from item in _context.ItemsToBuys
                     select item).Count() == 0;

            if (c)
            {
                var resourceNames = new List <string> {
                    "Metal", "Wood", "Plastic", "Cloth"
                };
                for (var i = 0; i < 60; i++)
                {
                    foreach (var item in resourceNames)
                    {
                        _context.ItemsToBuys.Add(new ItemsToBuy {
                            Guid = Guid.NewGuid().ToString(), Name = item
                        });
                    }
                }
                _context.SaveChanges();
            }
            ThingsToBuy.Add("Lille Hammer", new BuyingItem
            {
                Name  = "Lille Hammer",
                Metal = 3,
                Wood  = 2
            });
            ThingsToBuy.Add("Lille Sav", new BuyingItem
            {
                Name    = "Lille Sav",
                Metal   = 2,
                Plastic = 2
            });
            ThingsToBuy.Add("Saks", new BuyingItem
            {
                Name    = "Saks",
                Metal   = 3,
                Plastic = 3
            });
            ThingsToBuy.Add("Træplade A4", new BuyingItem
            {
                Name = "Træplade A4",
                Wood = 4
            });
            ThingsToBuy.Add("Søm", new BuyingItem
            {
                Name  = "Søm",
                Metal = 1
            });
            ThingsToBuy.Add("Grillspyd", new BuyingItem
            {
                Wood = 1,
                Name = "Grillspyd"
            });
            ThingsToBuy.Add("Tape", new BuyingItem
            {
                Plastic = 2,
                Cloth   = 1,
                Name    = "Tape"
            });
            ThingsToBuy.Add("Piberender", new BuyingItem
            {
                Name  = "Piberenser",
                Cloth = 2,
                Metal = 1
            });
            ThingsToBuy.Add("Snor", new BuyingItem
            {
                Name  = "Snor",
                Cloth = 3
            });
            ThingsToBuy.Add("Papir A4", new BuyingItem
            {
                Name = "Papir A4",
                Wood = 1
            });
        }
 public LogLinesController(Ch2CContext context)
 {
     _context = context;
 }