Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ProductDBContext context = new ProductDBContext();
            var product = context.Products;

            var product1 = product.Add(new Product()
            {
                ProductID = 1, Name = "coffee drink", Price = 67, Quantity = "250ml", CategoryID = 1
            });
            var product2 = product.Add(new Product()
            {
                ProductID = 2, Name = "badam drink", Price = 67, Quantity = "250ml", CategoryID = 1
            });
            var product3 = product.Add(new Product()
            {
                ProductID = 3, Name = "coke drink", Price = 67, Quantity = "250ml", CategoryID = 1
            });

            var categories = context.Categories;

            var category1 = categories.Add(new Category()
            {
                CategoryID = 1, Name = "Beverages"
            });

            context.SaveChanges();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            ProductDBContext context = new ProductDBContext();

            LinqToEntity();
            var product = context.Products;

            var product1 = product.Add(new Product()
            {
                ProductID = 1, Name = "frooti", Price = 99.99, Quantity = "500 ml", CategoryID = 1
            });
            var product2 = product.Add(new Product()
            {
                ProductID = 2, Name = "mazza", Price = 59.99, Quantity = "200 ml", CategoryID = 1
            });
            var product3 = product.Add(new Product()
            {
                ProductID = 1, Name = "coke", Price = 89.99, Quantity = "300 ml", CategoryID = 1
            });
            var categories = context.categories;
            var category1  = categories.Add(new Category()
            {
                CategoryID = 1, Name = "beverages"
            });

            context.SaveChanges();
        }