Exemplo n.º 1
0
        static void Main(string[] args)
        {
            catlogContext = new CatlogContext();

            CatlogItem catlogItem = new CatlogItem
            {
                Name     = "Orange",
                Price    = 80,
                Quantity = 50,
                Vendors  = new List <Vendor>
                {
                    new Vendor {
                        Id = 1, Name = "ABC Expoert"
                    },
                    new Vendor {
                        Id = 2, Name = "PQR Expoert"
                    },
                    new Vendor {
                        Id = 3, Name = "XYZ Expoert"
                    },
                    new Vendor {
                        Id = 4, Name = "MNO Expoert"
                    }
                }
            };

            InsertItem(catlogItem);
            GetCatlogItem();

            //same you can try for update delete

            Console.ReadLine();
        }
Exemplo n.º 2
0
 private static void InsertItem(CatlogItem catlogItem)
 {
     catlogContext.CatlogItems.InsertOne(catlogItem);
 }