예제 #1
0
        public async Task <NoteV1> UpdateNoteAsync(string correlationId, NoteV1 note)
        {
            lock (_lock)
            {
                _notes[note.Id] = note;
            }

            return(await Task.FromResult(note));
        }
예제 #2
0
 public async Task <NoteV1> UpdateNoteAsync(string correlationId, NoteV1 note)
 {
     return(await CallCommandAsync <NoteV1>(
                "update_note",
                correlationId,
                new
     {
         note = note
     }
                ));
 }
예제 #3
0
        public async Task <NoteV1> CreateNoteAsync(string correlationId, NoteV1 note)
        {
            note.Id = note.Id ?? IdGenerator.NextLong();

            lock (_lock)
            {
                _notes[note.Id] = note;
            }

            return(await Task.FromResult(note));
        }
예제 #4
0
        public async Task <NoteV1> GetNoteByIdAsync(string correlationId, string id)
        {
            NoteV1 result = null;

            lock (_lock)
            {
                //_Notes.TryGetValue(id, out result);
                result = _notes.FirstOrDefault(t => t.Value.Id == id).Value;
            }

            return(await Task.FromResult(result));
        }
예제 #5
0
        public async Task <NoteV1> DeleteNoteByIdAsync(string correlationId, string id)
        {
            NoteV1 result = null;

            lock (_lock)
            {
                _notes.TryGetValue(id, out result);
                if (result != null)
                {
                    _notes.Remove(id);
                }
            }

            return(await Task.FromResult(result));
        }
예제 #6
0
 public async Task <NoteV1> UpdateNoteAsync(string correlationId, NoteV1 note)
 {
     return(await SafeInvokeAsync(correlationId, "UpdateNoteAsync",
                                  () => _persistence.UpdateNoteAsync(correlationId, note)));
 }
 private static NoteV1MongoDbSchema FromPublic(NoteV1 value)
 {
     return(ObjectMapper.MapTo <NoteV1MongoDbSchema>(value));
 }
        public async Task <NoteV1> UpdateNoteAsync(string correlationId, NoteV1 note)
        {
            var result = await UpdateAsync(correlationId, FromPublic(note));

            return(ToPublic(result));
        }
예제 #9
0
 public static void AssertEqual(NoteV1 expected, NoteV1 actual)
 {
     //Assert.Equal(expected.Id, actual.Id);
     Assert.Equal(expected.Title, actual.Title);
     Assert.Equal(expected.Description, actual.Description);
 }