Beispiel #1
0
        public ActionResult MultipleVerses(string[] translations, string verses)
        {
            ResetTranslations(ref translations);
            var references = verses.Split(',')
                             .ToList()
                             .ConvertAll(x => VerseRangeReference.Parse(x));
            var model = SharedData.Document.QuranDocument.GetVersesInRange(references);

            return(PartialView("VersesView", model));
        }
Beispiel #2
0
        public ActionResult MultipleVerses(string verses)
        {
            SetTranslationsViewBag();
            ViewBag.VerseReferences = verses;
            var references = verses.Split(',')
                             .ToList()
                             .ConvertAll(x => VerseRangeReference.Parse(x));
            var model = SharedData.Document.QuranDocument.GetVersesInRange(references);

            return(View(model));
        }
        void AddVerseReference(MultiPartReference hadithReference, string verseRangeReferenceText)
        {
            var verseRangeReference = VerseRangeReference.Parse(verseRangeReferenceText);
            HashSet <VerseRangeReference> verseRangeReferences;

            if (!VersesByHadith.TryGetValue(hadithReference, out verseRangeReferences))
            {
                verseRangeReferences            = new HashSet <VerseRangeReference>();
                VersesByHadith[hadithReference] = verseRangeReferences;
            }
            verseRangeReferences.Add(verseRangeReference);
        }
Beispiel #4
0
        public ActionResult Index(string verses, int?context)
        {
            IEnumerable <VerseRangeReference> verseRangeReferences = verses.Split(',')
                                                                     .ToList()
                                                                     .ConvertAll(x => VerseRangeReference.Parse(x));

            if (!verseRangeReferences.Any())
            {
                verseRangeReferences = new VerseRangeReference[] { new VerseRangeReference(1, 1, 1) }
            }
            ;

            VerseRangeReference firstReference = verseRangeReferences.First();
            bool autoScrollToSelectedVerse     = verseRangeReferences.Count() == 1 && context.HasValue && context > 0;

            if (autoScrollToSelectedVerse)
            {
                verseRangeReferences = AddSurroundingVerses(context, firstReference);
            }

            IEnumerable <Verse> retrievedVerses = VerseRepository.GetVerses(verseRangeReferences)
                                                  .OrderBy(x => x.ChapterNumber)
                                                  .ThenBy(x => x.VerseNumber);

            var displayVerses = new List <ChapterAndVerseSelection>();

            foreach (VerseRangeReference verseRangeReference in verseRangeReferences)
            {
                IEnumerable <Verse> currentSelection =
                    retrievedVerses
                    .Where(x => verseRangeReference.Includes(x.ChapterNumber, x.VerseNumber));
                var chapterAndSelection = new ChapterAndVerseSelection(ChapterRepository.Get(verseRangeReference.Chapter), currentSelection);
                displayVerses.Add(chapterAndSelection);
            }

            var viewModel = new ViewModel(
                displayVerses: displayVerses,
                selectChapterAndVerse: new SelectChapterAndVerse(
                    firstReference.Chapter,
                    firstReference.FirstVerse,
                    url: ""),
                autoScrollToSelectedVerse: autoScrollToSelectedVerse
                );

            return(View("QuranVerses", viewModel));
        }