Example #1
0
        private DynamicParameters GetParameters(BeerLabels labels)
        {
            var queryParameters = new DynamicParameters();

            queryParameters.Add("@Icon", labels.Icon);
            queryParameters.Add("@Medium", labels.Medium);
            queryParameters.Add("@Large", labels.Large);
            queryParameters.Add("@ContentAwareIcon", labels.ContentAwareIcon);
            queryParameters.Add("@ContentAwareMedium", labels.ContentAwareMedium);
            queryParameters.Add("@ContentAwareLarge", labels.ContentAwareLarge);

            return(queryParameters);
        }
Example #2
0
        public async Task <BeerLabels> InsertBeerLabelsAsync(BeerLabels labels)
        {
            using (var connection = new SqlConnection(this.config["DBConnectionString"]))
            {
                connection.Open();

                using (var transaction = connection.BeginTransaction())
                {
                    try
                    {
                        var result = await connection.QuerySingleAsync <BeerLabels>("InsertBeerLabels", this.GetParameters(labels), commandType : CommandType.StoredProcedure, transaction : transaction);

                        transaction.Commit();

                        return((BeerLabels)result);
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        throw ex;
                    }
                }
            }
        }
Example #3
0
 public async Task <BeerLabels> InsertBeerLabelsAsync(BeerLabels labels)
 {
     return(await this.beerLabelsGateway.InsertBeerLabelsAsync(labels));
 }