Пример #1
0
        public static long CreateVerse(VerseDTO verse)
        {
            Verses verses = new Verses();

            verses.BeliefId   = verse.BeliefId;
            verses.Book       = verse.Book;
            verses.Chapter    = verse.Chapter;
            verses.VerseStart = verse.VerseStart;
            verses.VerseEnd   = verse.VerseEnd;
            verses.Verse      = verse.ToString();
            context.Add <Verses>(verses);
            context.SaveChanges();
            return(verses.Id);
        }
Пример #2
0
        internal string GetVerseText(VerseDTO verse)
        {
            StringBuilder sb     = new StringBuilder();
            var           conn   = GetConnection();
            var           comm   = new SqliteCommand($"SELECT verse, content FROM bible_fts WHERE book = '{Books.BookAbbrevArray[verse.Book]}' AND CAST(chapter AS int) = {verse.Chapter+1} AND CAST(verse AS int) >= {verse.VerseStart+1} and CAST(verse as int) <= {verse.VerseEnd+1}; ", conn);
            var           reader = comm.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    sb.Append("(" + reader.GetString(0) + ") ");
                    sb.Append(reader.GetString(1) + "\r\n");
                }
            }
            sb.Append(" - " + verse.ToString());
            return(sb.ToString());
        }