示例#1
0
        public void InitStore()
        {
            var db = new Context();

            var cat1 = new Category() { Name = "Produto" };
            var cat2 = new Category() { Name = "Servico" };

            db.Category.Add(cat1); db.Category.Add(cat2);

            var i1 = new Item() { Name = "Ração Whiskas", Category = cat1 };
            var i2 = new Item() { Name = "Banho", Category = cat2 };
            var i3 = new Item() { Name = "Tosa", Category = cat2 };

            db.Item.Add(i1);
            db.Item.Add(i2);
            db.Item.Add(i3);

            var c1 = new Client() { Name = "Rafael", Email = "*****@*****.**" };
            var c2 = new Client() { Name = "Monica", Email = "*****@*****.**" };

            db.Client.Add(c1);
            db.Client.Add(c2);

            db.SaveChanges();
        }
示例#2
0
 public void AddClient(Client client)
 {
     _context.Client.Add(client);
 }