Beispiel #1
0
        CtrlProductListing Setup()
        {
            #region - code -

            var tst = new CtrlProductListing(null, null)
            {
                network = new Master.LocalNetwork {
                    sqlServer = connStr
                }
            };

            SetupDatabase();

            using (var db = new NpgsqlConnection(connStr))
            {
                db.Open();

                var repo = new DapperProductRepository();

                var repoAdmin = new DapperAdminRepository();

                repoAdmin.InsertBrand(db, new Brand {
                    stName = "Samsung"
                });
                repoAdmin.InsertBrand(db, new Brand {
                    stName = "Toshiba"
                });

                repoAdmin.InsertCategory(db, new Category {
                    stName = "TVs", fkMainCategory = 0, fkCountry = 1
                });

                repo.InsertProduct(db, new Product {
                    stName = "Livro", nuPrice = 12345, stDesc = "Livro desc", fkBrand = 1, fkCategory = 1, fkCountry = 1
                });
                repo.InsertProductCatalog(db, new ProductCatalog {
                    stTag = "Livro"
                });
                repo.InsertProductCatalogLink(db, new ProductCatalogLink {
                    fkProduct = 1, fkProductCatalog = 1
                });

                db.Close();
            }

            return(tst);

            #endregion
        }
        CtrlBrand Setup()
        {
            #region - code -

            var tst = new CtrlBrand(null, null)
            {
                network = new Master.LocalNetwork {
                    sqlServer = connStr
                }
            };

            SetupDatabase();

            using (var db = new NpgsqlConnection(connStr))
            {
                db.Open();

                var repo = new DapperAdminRepository();

                repo.InsertBrand(db, new Master.Infra.Entity.Database.Brand
                {
                    stName = "Samsung"
                });

                repo.InsertBrand(db, new Master.Infra.Entity.Database.Brand
                {
                    stName = "Toshiba"
                });

                db.Close();
            }

            return(tst);

            #endregion
        }