Esempio n. 1
0
 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>()
     });
 }
Esempio n. 2
0
        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)
                });
            }
        }