Exemplo n.º 1
0
 protected static void AddTodoItem(
     NpgsqlConnection conn,
     Guid key,
     string description,
     bool isComplete,
     DateTime timeCreated)
 {
     TodoStorageCommands.AddNewItem(conn, key, description, isComplete, timeCreated).ExecuteNonQuery();
 }
Exemplo n.º 2
0
        protected static List <TodoItem> GetTodoList(NpgsqlConnection conn)
        {
            var retVal = new List <TodoItem>();

            using (var reader = TodoStorageCommands.GetAllTodoItems(conn).ExecuteReader())
            {
                while (reader.Read())
                {
                    var item = new TodoItem
                    {
                        Key         = reader.GetGuid(reader.GetOrdinal(PgEnums.Tables.TodoItems.key_uid.ToString())),
                        Description = reader.GetString(reader.GetOrdinal(PgEnums.Tables.TodoItems.description.ToString())),
                        IsComplete  = reader.GetBoolean(reader.GetOrdinal(PgEnums.Tables.TodoItems.is_complete.ToString())),
                        TimeCreated = reader.GetDateTime(reader.GetOrdinal(PgEnums.Tables.TodoItems.time_created.ToString()))
                    };

                    retVal.Add(item);
                }
            }

            return(retVal);
        }