/// <summary> /// update ad. /// </summary> /// <returns>Task<System.Boolean>.</returns> public async Task<bool> UpdateAsync() { var content = new SqlParameter("content", SqlDbType.VarChar) { Value = "Test" }; var id = new SqlParameter("id", SqlDbType.Int) { Value = 1 }; var config = new SqlConfiguration(ConnectionString, "UpdateAd") { SqlParameters = new List<SqlParameter> { content, id } }; return await sqlClient.CommandAsync(config) > 0; }
/// <summary> /// Insert new ad. /// </summary> /// <returns>Task<System.Boolean>.</returns> public async Task<bool> InsertAsync() { SqlParameter content = new SqlParameter("content", SqlDbType.VarChar) { Value = "Test" }; var config = new SqlConfiguration(ConnectionString, "InsertAd") { SqlParameters = new List<SqlParameter> { content } }; return await sqlClient.CommandAsync(config) > 0; }
/// <summary> /// Gets ads. /// </summary> /// <returns>Task<IEnumerable<Ad>>.</returns> public async Task<IEnumerable<Ad>> GetAsync() { var config = new SqlConfiguration(ConnectionString, Settings.GetAd, SprocMode.ExecuteReader); return await sqlClient.QueryAsync(config, AdsLoader); }