public override ChapterVersion GetPreviousChapter(string chapterId, string articleId) { using (TransactionScope transaction = new TransactionScope(mConfiguration)) { ChapterVersionDataStore chapVersion = new ChapterVersionDataStore(transaction); IList <ChapterVersion> chVersList = chapVersion.FindAllItemsByArticleId(articleId); int seq = 0; if (!string.IsNullOrEmpty(chapterId)) // if this is null then the first chapter is loaded by default. { seq = chVersList.IndexOf(chVersList.First(x => x.Id.Equals(chapterId))); } if (seq == 0) { return(new ChapterVersion()); } else { if (seq != 0) { return(chVersList.ElementAt(seq - 1)); } else { return(new ChapterVersion()); } } } }
public override IList <ChapterVersion> GetAllItemsByArticleId(string articleId) { using (TransactionScope transaction = new TransactionScope(mConfiguration)) { ChapterVersionDataStore chapVersion = new ChapterVersionDataStore(transaction); IList <ChapterVersion> dsChapters = chapVersion.FindAllItemsByArticleId(articleId); return(dsChapters); } }