public async Task CreateUserAsync(Guid id, string username) { using (var connection = await GetOpenConnectionAsync()) using (var command = new SqlCommand(InsertStatement, connection)) { command.Parameters.AddWithValue("Id", id); command.Parameters.AddWithValue("Username", username); command.Parameters.AddWithValue("CreateUserId", Auditor.UserId); command.Parameters.AddWithValue("CreateDate", Auditor.Now()); await command.ExecuteNonQueryAsync(); } }
public async Task <int> CreateBlogAsync(Guid id, string name) { using (var connection = await GetOpenConnectionAsync()) using (var command = new SqlCommand(InsertStatement, connection)) { await connection.OpenAsync(); command.Parameters.AddWithValue("Id", id); command.Parameters.AddWithValue("Name", name); command.Parameters.AddWithValue("Creator", Auditor.UserId); command.Parameters.AddWithValue("CreatedOn", Auditor.Now()); return((int)await command.ExecuteScalarAsync()); } }