Exemplo n.º 1
0
        public Task DeleteRecordAsync(int storageHandle, string type, string id)
        {
            var record = StoredRecords.SingleOrDefault(x => x.Id == id && x.Type == type);

            StoredRecords.Remove(record);
            return(Task.CompletedTask);
        }
Exemplo n.º 2
0
        public Task UpdateRecordTagsAsync(int storageHandle, string type, string id, string tagsJson)
        {
            var record = StoredRecords.Single(x => x.Id == id && x.Type == type);

            record.Tags = tagsJson;
            return(Task.CompletedTask);
        }
Exemplo n.º 3
0
        public Task UpdateRecordValueAsync(int storageHandle, string type, string id, byte[] value)
        {
            var record = StoredRecords.Single(x => x.Id == id && x.Type == type);

            record.Value = value;
            return(Task.CompletedTask);
        }
Exemplo n.º 4
0
        public Task <int> GetRecordAsync(int storageHandle, string type, string id, string optionsJson)
        {
            var record = StoredRecords.Single(x => x.Id == id && x.Type == type);

            var nextRecordHandle = RecordHandles.Keys.MaxOrDefault() + 1;

            RecordHandles.Add(nextRecordHandle, record);

            return(Task.FromResult(nextRecordHandle));
        }
Exemplo n.º 5
0
        public Task AddRecordAsync(int storageHandle, string type, string id, byte[] value, string tagsJson)
        {
            var record = new StorageRecord
            {
                Id    = id,
                Type  = type,
                Value = value,
                Tags  = tagsJson
            };

            StoredRecords.Add(record);
            return(Task.CompletedTask);
        }