Example #1
0
        public Task <NoteTake> GetByIDAsync(string id)
        {
            NoteTake entry = null;

            entries.TryGetValue(id, out entry);
            return(Task.FromResult <NoteTake>(entry));
        }
Example #2
0
        public static void LoadData(this INoteEntryStorage store)
        {
            var a = new NoteTake
            {
                Title = "Sprint Planning Meeting",
                Text  = "1. Scope 2. Backlog 3. Duration"
            };

            var b = new NoteTake
            {
                Title = "Daily Scrum Stand-up",
                Text  = "1. Yesterday 2.Today 3. Impediments"
            };

            var c = new NoteTake
            {
                Title = "Sprint Retrospective",
                Text  = "1. Reflection 2. Actions"
            };

            Task.WhenAll(
                store.AddAsync(a),
                store.AddAsync(b),
                store.AddAsync(c))
            .ConfigureAwait(false);
        }
Example #3
0
        public async Task DeleteAsync(NoteTake entry)
        {
            await InitializeAsync();

            if (loadedNotes.Remove(entry))
            {
                await SaveDataAsync(filename, loadedNotes);
            }
        }
Example #4
0
        public async Task UpdateAsync(NoteTake entry)
        {
            await InitializeAsync();

            if (!loadedNotes.Contains(entry))
            {
                throw new Exception($"NoteTake {entry.Title} was not found in the {nameof(FileEntryStorage)}. Did you forget to add it?");
            }
            await SaveDataAsync(filename, loadedNotes);
        }
Example #5
0
        public async Task AddAsync(NoteTake entry)
        {
            await InitializeAsync();

            if (!loadedNotes.Any(ne => ne.ID == entry.ID))
            {
                loadedNotes.Add(entry);
                await SaveDataAsync(filename, loadedNotes);
            }
        }
Example #6
0
 public Task DeleteAsync(NoteTake entry)
 {
     entries.Remove(entry.ID);
     return(Task.CompletedTask);
 }
Example #7
0
 public Task UpdateAsync(NoteTake entry)
 {
     return(Task.CompletedTask);
 }
Example #8
0
 public Task AddAsync(NoteTake entry)
 {
     entries.Add(entry.ID, entry);
     return(Task.CompletedTask);
 }