public Task <IDictionary <long, WorkChapter> > GetWorkChaptersAsync(IEnumerable <long> works) { return(Task.Run(() => { using (ReadWriteLock.ReadLock()) { IDictionary <long, WorkChapter> r = new Dictionary <long, WorkChapter>(); foreach (long w in works) { if (storage.TryGetValue(w, out Work work)) { r[w] = new WorkChapter(work); } } return r; } })); }
/// <summary> /// PUT api/values/5 /// Put a single WorkChapter /// </summary> /// <param name="id">Work id</param> /// <param name="value">WorkChapter to set</param> /// <returns>Existing item in case of conflict</returns> public IDictionary <long, WorkChapter> Put(long id, [FromBody] WorkChapter value) { return(Post(new Dictionary <long, WorkChapter> { [id] = value })); }