public void InsertProductInventory(ProductModel product, InventoryModel inventory)
        {
            try
            {
                _sql.StartTransaction("TulipData");
                int newProductId = _sql.CreateProductTransaction("dbo.spProduct_Insert", product);

                inventory.ProductId = newProductId;

                _sql.SaveDataInTransaction("dbo.spInventory_Insert", inventory);
                _sql.CommitTransaction();
            }
            catch
            {
                _sql.RollbackTransaction();
                throw;
            }
        }
Esempio n. 2
0
        public void InsertProductInventory(ProductModel product, InventoryModel inventory)
        {
            //using (SqlDataAccess sql = new SqlDataAccess())
            //{
            try
            {
                _sqlDataAccess.StartTransaction("TulipData");
                int newProductId = _sqlDataAccess.CreateProductTransaction("dbo.spProduct_Insert", product);

                inventory.ProductId = newProductId;

                _sqlDataAccess.SaveDataInTransaction("dbo.spInventory_Insert", inventory);
                _sqlDataAccess.CommitTransaction();
            }
            catch
            {
                _sqlDataAccess.RollbackTransaction();
                throw;
            }
            //}
        }