public async Task <DatabaseModel.ItemBetted> InsertAsync(DatabaseModel.ItemBetted itemBetted) { var query = _itemBetQueries.InsertAsync(itemBetted); await _databaseConnection.ExecuteNonQueryAsync(query); return(itemBetted); }
public async Task SetSettingsAsync(DatabaseModel.Settings settings) { var dict = new Dictionary <string, object> { { "@InventoryLimit", settings.InventoryLimit }, { "@ItemValueLimit", settings.ItemValueLimit }, { "@SteamInventoryCacheTimerInSec", settings.SteamInventoryCacheTimerInSec }, { "@UpdatedPricingTime", settings.UpdatedPricingTime }, { "@NrOfLatestChatMessages", settings.NrOfLatestChatMessages }, }; if (await HasAlreadyAdded()) { var sqlQueryUpdate = new SqlQuery("UPDATE [Settings] SET " + "InventoryLimit = @InventoryLimit, " + "ItemValueLimit = @ItemValueLimit, " + "SteamInventoryCacheTimerInSec = @SteamInventoryCacheTimerInSec, " + "UpdatedPricingTime = @UpdatedPricingTime, " + "NrOfLatestChatMessages= @NrOfLatestChatMessages " + "WHERE Id = 1", dict); await _databaseConnection.ExecuteNonQueryAsync(sqlQueryUpdate); return; } //insert var sqlQuery = new SqlQuery( "INSERT INTO [Settings] (InventoryLimit, ItemValueLimit, SteamInventoryCacheTimerInSec, UpdatedPricingTime, NrOfLatestChatMessages) " + "VALUES (@InventoryLimit,@ItemValueLimit,@SteamInventoryCacheTimerInSec,@UpdatedPricingTime,@NrOfLatestChatMessages);", dict); await _databaseConnection.ExecuteNonQueryAsync(sqlQuery); }
public async Task UpdateImageAsync(string steamId, string imageUrl) { var query = _userQueries.UpdateUsersImage(steamId, imageUrl); var affectedRows = await _databaseConnection.ExecuteNonQueryAsync(query); if (affectedRows != 1) { throw new NoneExpectedResultException($"Expected the row match count to be one, it was {affectedRows}"); } }
public async Task InsertAsync(List <DatabaseModel.ItemInOfferTransaction> itemInOfferTransactions, ITransactionWrapper transactionWrapper = null) { var query = _itemInOfferTransactionQueries.InsertRange(itemInOfferTransactions); if (transactionWrapper != null) { await transactionWrapper.ExecuteSqlCommand(query); return; } await _databaseConnection.ExecuteNonQueryAsync(query); }
public async Task AddAsync(string username, string password) { string query = "INSERT INTO users (username, password) VALUES(@username, @password);"; var parameters = new ParameterContainer(); parameters.Add("@username", username); parameters.Add("@password", password); await _connection.OpenAsync(); await _connection.ExecuteNonQueryAsync(query, parameters); _connection.Close(); }
public async Task <int> Remove(int id) { var query = _levelQueries.Remove(id); return(await _databaseConnection.ExecuteNonQueryAsync(query)); }
public async Task AddSteamIdToOffer(int offerTransactionId, string steamOfferId) { var query = _offerTransationQueries.UpdateSteamOfferId(offerTransactionId, steamOfferId); var res = await _databaseConnection.ExecuteNonQueryAsync(query); }
public async Task UpdateImg(string name, string imgUrl) { var query = _itemDescriptionQueries.UpdateImgUrl(name, imgUrl); await _databaseConnection.ExecuteNonQueryAsync(query); }
public async Task AddWinnerToMatch(DatabaseModel.User winner, int matchRoundId) { var query = _matchQueries.AddWinner(winner.Id, matchRoundId); await _databaseConnection.ExecuteNonQueryAsync(query); }