Esempio n. 1
0
 public ViewModel(
     CommentatorAndCommentary commentatorAndCommentary,
     SelectChapterAndVerse selectChapterAndVerse)
 {
     CommentatorAndCommentary = commentatorAndCommentary;
     SelectChapterAndVerse    = selectChapterAndVerse;
 }
Esempio n. 2
0
        public ActionResult Index(string commentatorCode, int chapterNumber, int verseNumber)
        {
            if (!CommentatorRepository.TryGet(commentatorCode, out Commentator commentator))
            {
                return(HttpNotFound());
            }

            Commentary commentary = CommentaryRepository.GetForVerse(
                commentatorCode: commentatorCode,
                chapterNumber: chapterNumber,
                verseNumber: verseNumber);

            if (commentary == null)
            {
                commentary = new Commentary(
                    commentatorCode: commentatorCode,
                    chapterNumber: chapterNumber,
                    firstVerseNumber: verseNumber,
                    lastVerseNumber: verseNumber,
                    text: new[] { new TextContent("No tafsir found for this verse", false) });
            }

            var commentatorAndCommentary = new CommentatorAndCommentary(
                commentator: commentator,
                commentary: commentary);

            string url = $"/Tafsir/{commentatorCode}/";
            var    selectChapterAndVerse = SelectChapterAndVerseFactory.CreateForCommentary(
                commentatorCode: commentatorCode,
                selectedChapterNumber: chapterNumber,
                selectedVerseNumber: verseNumber,
                url: url);

            var viewModel = new ViewModel(
                commentatorAndCommentary: commentatorAndCommentary,
                selectChapterAndVerse: selectChapterAndVerse);

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