コード例 #1
0
        public ActionResult <DtoBrand> brand([FromQuery] string id)
        {
            var repo = new DapperAdminRepository();
            var srv  = new SrvBrandGetV1(repo, cache);
            var dto  = new DtoBrand();

            if (!srv.Exec(network, Convert.ToInt32(id), ref dto))
            {
                return(BadRequest(srv.Error));
            }

            return(Ok(dto));
        }
コード例 #2
0
        public ActionResult brandListing([FromBody] DtoBrandListing obj)
        {
            var repo = new DapperAdminRepository();
            var srv  = new SrvBrandListingV1(repo, cache);
            var dto  = new DtoBrandListingResult();

            if (!srv.Exec(network, obj, ref dto))
            {
                return(BadRequest(srv.Error));
            }

            return(Ok(dto));
        }
コード例 #3
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
        }
コード例 #4
0
        public ActionResult Post([FromBody] DtoProductListing obj)
        {
            var repo      = new DapperProductRepository();
            var adminRepo = new DapperAdminRepository();

            var srv = new SrvProductListingV1(repo, adminRepo, cache);
            var ret = new DtoProductListingResult();

            if (!srv.Exec(network, obj, ref ret))
            {
                return(BadRequest(srv.Error));
            }

            return(Ok(ret));
        }
コード例 #5
0
        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
        }