Beispiel #1
0
        public ActionResult Verses(int id)
        {
            BibleTopicsViewModel btvm = new BibleTopicsViewModel();
            btvm.TopicLetters = repo.GetAllTopicsInitialLetters();
            int topicID = id;
            string topicName = repo.GetTopicName(id);

            ViewBag.TopicName = topicName;
            ViewBag.PageName = "Verses for " + topicName;

            btvm.VerseWithTopics = new Dictionary<Bible, List<Topic>>();

            // Get bible verses for this topic
            List<int> bibleIDs = repo.GetAllOrderedVersesByTopicID(topicID);
            Bible verseTemp = new Bible();
            List<int> topicIDs = new List<int>();
            List<Topic> topicsTemp = new List<Topic>();
            List<Topic> topicsAlphaTemp = new List<Topic>();
            Topic sameTopicName;
            foreach (int bibleID in bibleIDs)
            {
                verseTemp = repo.GetBible(bibleID);
                topicIDs = repo.GetTopicIDsPerBibleID(verseTemp.ID);
                foreach (int t_ID in topicIDs)
                {
                    sameTopicName = repo.GetTopic(t_ID);
                    if (sameTopicName.Name == topicName)
                        continue;
                    topicsTemp.Add(repo.GetTopic(t_ID));
                }
                topicsAlphaTemp = topicsTemp.OrderBy(x => x.Name).ToList();
                topicsTemp.Clear();
                btvm.VerseWithTopics.Add(verseTemp, topicsAlphaTemp);
            }

            return View(btvm);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Bibles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToBibles(Bible bible)
 {
     base.AddObject("Bibles", bible);
 }
 /// <summary>
 /// Create a new Bible object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="verse">Initial value of the Verse property.</param>
 /// <param name="message">Initial value of the Message property.</param>
 /// <param name="created">Initial value of the Created property.</param>
 /// <param name="isValid">Initial value of the IsValid property.</param>
 /// <param name="bookID">Initial value of the BookID property.</param>
 public static Bible CreateBible(global::System.Int32 id, global::System.String verse, global::System.String message, global::System.DateTime created, global::System.Boolean isValid, global::System.Int32 bookID)
 {
     Bible bible = new Bible();
     bible.ID = id;
     bible.Verse = verse;
     bible.Message = message;
     bible.Created = created;
     bible.IsValid = isValid;
     bible.BookID = bookID;
     return bible;
 }
 /// <summary>
 /// Add a new verse
 /// </summary>
 /// <param name="topic">Bible entity</param>
 public void AddNewVerse(Bible bible)
 {
     dbase.Bibles.AddObject(bible);
 }