// Basic public async Task <int> AddAsync(PaymentOperationEntity paymentOperationEntity) { int indicator = -1; try { var dynamicParameters = new DynamicParameters(paymentOperationEntity); dynamicParameters.Add("PaymentOperationId", DbType.Int32, direction: ParameterDirection.Output); using (var connection = new SqlConnection(_connectionString)) { indicator = await connection.ExecuteAsync( _paymentCommandText.AddPaymentOperation, dynamicParameters, commandType : CommandType.StoredProcedure ); paymentOperationEntity.PaymentOperationId = dynamicParameters.Get <int>("PaymentOperationId"); } } catch (Exception exception) { } return(indicator); }
public async Task <PaymentOperationEntity> GetByIdAsync(int paymentOperationId) { var rs = new PaymentOperationEntity(); try { using (var connection = new SqlConnection(_connectionString)) { rs = await connection.QueryFirstOrDefaultAsync <PaymentOperationEntity>( _paymentCommandText.GetPaymentOperationById, new { PaymentOperationId = paymentOperationId }, commandType : CommandType.StoredProcedure ); } } catch (Exception exception) { } return(rs); }
public async Task <int> UpdateAsync(PaymentOperationEntity paymentOperationEntity) { int indicator = -1; try { var dynamicParameters = new DynamicParameters(paymentOperationEntity); using (var connection = new SqlConnection(_connectionString)) { indicator = await connection.ExecuteAsync( _paymentCommandText.UpdatePaymentOperation, dynamicParameters, commandType : CommandType.StoredProcedure ); } } catch (Exception exception) { } return(indicator); }
public async Task <int> UpdateAsync(PaymentOperationEntity paymentOperationEntity) { return(await _paymentOperationRepository.UpdateAsync(paymentOperationEntity)); }