public async Task Apply(TodoListCreated evnt) { await _store.InsertAsync(new TodoListView { Id = evnt.ListId, Title = evnt.Title, OwnerId = evnt.OwnerId, Items = new Dictionary <string, TodoListItem>() }); }
public async Task Apply(TodoListCreated evnt) { using (IDbConnection dbConnection = new NpgsqlConnection(_connectionString)) { dbConnection.Open(); int result = await dbConnection.ExecuteAsync( "INSERT INTO todolists (id, title, ownerid) " + "VALUES (@Id, @Title, @OwnerId)", new { Id = Guid.Parse(evnt.ListId), Title = evnt.Title, OwnerId = Guid.Parse(evnt.OwnerId) }); } }