Esempio n. 1
0
        private static IEnumerable <VerseRangeReference> AddSurroundingVerses(int?context, VerseRangeReference firstReference)
        {
            IEnumerable <VerseRangeReference> verseRangeReferences;
            int numberOfVerses    = QuranStructure.Chapter(firstReference.Chapter).NumberOfVerses;
            int firstVerse        = Math.Max(1, firstReference.FirstVerse - context.Value);
            int lastVerse         = Math.Min(numberOfVerses, firstReference.LastVerse + context.Value);
            var newVerseReference = new VerseRangeReference(
                chapter: firstReference.Chapter,
                firstVerse: firstVerse,
                lastVerse: lastVerse);

            verseRangeReferences = new[] { newVerseReference };
            return(verseRangeReferences);
        }
Esempio n. 2
0
        public ActionResult Index(string commentatorCode, int chapterNumber, int verseNumber)
        {
            if (!QuranStructure.TryValidateChapterAndVerse(chapterNumber, verseNumber))
            {
                return(HttpNotFound());
            }

            CommentariesForVerse viewModel = CommentariesForVerseBuilder.Create(
                commentatorCode: commentatorCode,
                chapterNumber: chapterNumber,
                verseNumber: verseNumber);

            return(View("CommentariesForVerse", viewModel));
        }
Esempio n. 3
0
        public ActionResult Index(int chapterNumber, int verseNumber)
        {
            if (!QuranStructure.TryValidateChapterAndVerse(chapterNumber, verseNumber))
            {
                return(HttpNotFound());
            }

            Chapter chapter        = ChapterRepository.Get(chapterNumber);
            var     verseReference = new VerseReference(chapterNumber, verseNumber);
            IEnumerable <Persistence.Models.Hadith> hadiths =
                HadithRepository.GetForVerse(verseReference)
                .OrderBy(x => x.References[0]);

            IEnumerable <HadithViewModel> hadithViewModels = HadithViewModelFactory.Create(hadiths);
            var viewModel = new ViewModel(
                chapter: chapter,
                verseNumber: verseNumber,
                hadiths: hadithViewModels);

            return(View("VerseHadiths", viewModel));
        }
Esempio n. 4
0
        public ActionResult Index(int chapterNumber, int verseNumber)
        {
            if (!QuranStructure.TryValidateChapterAndVerse(chapterNumber, verseNumber))
            {
                return(HttpNotFound());
            }

            Chapter       chapter  = ChapterRepository.Get(chapterNumber);
            VerseAnalysis analysis =
                VerseAnalysisRepository.GetForVerse(chapterNumber, verseNumber);

            var selectChapterAndVerse = new SelectChapterAndVerse(
                selectedChapterNumber: chapterNumber,
                selectedVerseNumber: verseNumber,
                url: "/Analysis/");
            var viewModel = new ViewModel(
                chapter: chapter,
                verseNumber: verseNumber,
                verseAnalysis: analysis,
                selectChapterAndVerse: selectChapterAndVerse);

            return(View("VerseAnalysis", viewModel));
        }
Esempio n. 5
0
 public Chapter Get(int chapterNumber) => QuranStructure.Chapter(chapterNumber);