private ReaderItem CopyReaderItem(int?wordsRead = null) { var readerItem = new ReaderItem(); SelectedItem.CopyItem(readerItem); if (wordsRead.HasValue) { readerItem.WordsRead = wordsRead.Value; } if (string.IsNullOrEmpty(readerItem.Excerpt)) { readerItem.Excerpt = readerItem.Text.ToExcerpt(); } readerItem.Text = string.Empty; return(readerItem); }
private void SaveInProgressItems(int wordsRead, bool removeItem = false) { var readerItem = CopyReaderItem(wordsRead); var item = _inProgressItems.FirstOrDefault(x => x.Id == readerItem.Id); if (item != null) { if (removeItem) { _inProgressItems.Remove(item); } else { SelectedItem.CopyItem(item); } } else { _inProgressItems.Insert(0, readerItem); } _cacheService.SaveInProgressItems(_inProgressItems).ConfigureAwait(false); }