Пример #1
0
        public void AddChapterSelectList(List <MinBook> TemplateBooks)
        {
            List <SelectListItem> SelectList = new List <SelectListItem>();

            SelectList.Add(new SelectListItem
            {
                Text  = "Random Chapter",
                Value = "0",
            });
            if (BookNumber > 0) // Bok Number of 0 just means no book selected
            {
                // Find our book
                MinBook SelectedBook = TemplateBooks.Where(B => B.BookNumber == BookNumber).Single();
                for (int i = 1; i <= SelectedBook.Chapters; i++)
                {
                    SelectList.Add(new SelectListItem
                    {
                        Text  = i.ToString(),
                        Value = i.ToString(),
                    });
                }
                if (SelectedBook.HasCommentary == true)
                {
                    SelectList.Add(new SelectListItem
                    {
                        Text  = "SDA Bible Commentary",
                        Value = "1000",
                    });
                }
            }
            ChapterSelectList = SelectList;
        }
Пример #2
0
 public MinBible(Bible Bible)
 {
     LegalNote  = Bible.LegalNote;
     Id         = Bible.Id;
     Language   = Bible.Language;
     Version    = Bible.Version;
     BibleBooks = new List <MinBook>();
     foreach (BibleBook Book in Bible.BibleBooks)
     {
         MinBook minBook = new MinBook(Book);
         BibleBooks.Add(minBook);
     }
 }
Пример #3
0
        public async Task <List <MinBook> > GetTemplateBooksAsync(BiblePathsCoreDbContext context, string bibleId)
        {
            List <MinBook> ReturnList = new List <MinBook>();

            if (this.BookNumber < Bible.MinBookListID)
            {
                BibleBook Book = await context.BibleBooks.Where(B => B.BibleId == bibleId &&
                                                                B.BookNumber == this.BookNumber)
                                 .SingleAsync();

                Book.HasCommentary = await Book.HasCommentaryAsync(context);

                MinBook minBook = new MinBook(Book);
                ReturnList.Add(minBook);
            }
            else
            {
                QuizBookList BookList = await context.QuizBookLists.Where(L => L.Id == this.BookNumber &&
                                                                          L.IsDeleted == false)
                                        .Include(L => L.QuizBookListBookMaps)
                                        .SingleAsync();

                foreach (QuizBookListBookMap bookMap in BookList.QuizBookListBookMaps)
                {
                    BibleBook BookMapBook = await context.BibleBooks.Where(B => B.BibleId == bibleId &&
                                                                           B.BookNumber == bookMap.BookNumber)
                                            .SingleAsync();

                    BookMapBook.HasCommentary = await BookMapBook.HasCommentaryAsync(context);

                    MinBook minBook = new MinBook(BookMapBook);
                    ReturnList.Add(minBook);
                }
            }
            return(ReturnList);
        }