Exemplo n.º 1
0
        static void Main(string[] args)
        {
            LocalStoreContext ctx = new LocalStoreContext();
            var customers         = ctx.Customers.ToArray();
            var locations         = ctx.StoreLocations.ToArray();
            var products          = ctx.Products.ToArray();
            var sales             = ctx.Sales.ToList();

            ctx.Sales.Add(new Sale());
            ctx.SaveChanges();

            System.Console.WriteLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            LocalStoreContext context = new LocalStoreContext();

            Product milk = new Product("Milk", "Serdika OOD", "Caw's milk", 4, 3, 2.00m);

            //Product cheese = new Product("White feta cheese", "Himko OOD", "White feta cheese from caw's milk", 25.00m);
            //Product salam = new Product("Smocked game meat salami","Messtrans EOOD","Best quality salamy from organic meat from deers and wild boars", 23.00m );
            //Product vino = new Product("Red wine", "Kruchmata EOOD", "Best quality red wine from Tracian valley", 23.00m);

            context.Products.Add(milk);
            //context.Products.Add(cheese);
            //context.Products.Add(salam);
            //context.Products.Add(vino);


            context.SaveChanges();
        }
Exemplo n.º 3
0
        private static void Main(string[] args)
        {
            //1. Local Store - 3 products entered in the database;
            //2. Local Store Improvement - Weight and Quantity added to Product model - old data entered from 'Data_BackUp.sql';

            var context = new LocalStoreContext();

            List <Product> products = new List <Product>();

            products.Add(new Product()
            {
                Name            = "Cucumber",
                DistributorName = "Local Street Market",
                Description     = "Product From Bulgaria",
                Price           = 1.99m
            });

            products.Add(new Product()
            {
                Name            = "Tomato",
                DistributorName = "Local Street Market",
                Description     = "Product From Bulgaria",
                Price           = 1.49m
            });

            products.Add(new Product()
            {
                Name            = "Potato",
                DistributorName = "Local Street Market",
                Description     = "Product From Bulgaria",
                Price           = 0.99m
            });

            foreach (Product product in products)
            {
                context.Products.Add(product);
            }

            context.SaveChanges();
        }