コード例 #1
0
        public async Task <ProductEntityDomain> CreateProductAsync(ProductEntityDomain product)
        {
            await _productSqlDataContext.Connection.OpenAsync();

            using (var trans = _productSqlDataContext.Connection.BeginTransaction())
            {
                try
                {
                    await _productSqlDataContext.Connection.InsertAsync(ProductEntityData.ToEntityData(product), trans);

                    trans.Commit();
                    _productSqlDataContext.Connection.Close();
                }
                catch (System.Exception)
                {
                    trans.Rollback();
                    _productSqlDataContext.Connection.Close();
                }
            }

            return(product);
        }
コード例 #2
0
        public async Task <bool> UpdateProductAsync(ProductEntityDomain product)
        {
            var resultUpdate = await _productSqlDataContext.Connection.UpdateAsync <ProductEntityData>(ProductEntityData.ToEntityData(product));

            return(resultUpdate);
        }