Ejemplo n.º 1
0
        public ActionResult Root(string root)
        {
            root = ArabicHelper.LetterNamesToArabic(root);
            var model = new Analysis_Root(root);

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult Root(string root)
        {
            /*
             * root = ArabicHelper.LetterNamesToArabic(root);
             * var model = SharedData.Document.RootWordsDocument[root];
             * return View(model);
             */
            root = ArabicHelper.LetterNamesToArabic(root);
            var model = new Analysis_Root(root);

            return(View(model));
        }
Ejemplo n.º 3
0
        public ActionResult Index(string rootLetterNames)
        {
            string root = ArabicHelper.LetterNamesToArabic(rootLetterNames);
            IEnumerable <VerseAnalysis> verses =
                VerseAnalysisRepository.GetForRoot(root)
                .OrderBy(x => x.ChapterNumber)
                .ThenBy(x => x.VerseNumber);
            var extracts = new List <VerseViewModel>();

            foreach (VerseAnalysis verseAnalysis in verses)
            {
                foreach (VerseAnalysisWord analysisWord in verseAnalysis.Words)
                {
                    IEnumerable <VerseAnalysisWordPart> wordParts =
                        analysisWord.WordParts.Where(x => x.Root == root);
                    foreach (VerseAnalysisWordPart wordPart in wordParts)
                    {
                        VerseViewModel extract =
                            CreateVerseViewModel(verseAnalysis, analysisWord, wordPart);
                        extracts.Add(extract);
                    }
                }
            }

            var romanNumerals = new List <string> {
                "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"
            };
            var wordFormsData = extracts
                                .GroupBy(x => new
            {
                Type = x.SelectedWordPart.Description,
                x.SelectedWordPart.Form
            })
                                .OrderBy(x => romanNumerals.IndexOf(x.Key.Form));

            var wordTypesData = wordFormsData
                                .GroupBy(x => x.Key.Type)
                                .OrderBy(x => x.Key);

            var wordTypesViewModel = wordTypesData
                                     .Select(t =>
                                             new WordTypeViewModel(
                                                 type: t.Key,
                                                 wordForms: t.Select(f =>
                                                                     new WordFormViewModel(
                                                                         form: f.Key.Form,
                                                                         extracts: f
                                                                         )
                                                                     )
                                                 )
                                             );

            IEnumerable <DictionaryEntry> dictionaryEntries =
                DictionaryEntryRepository.Get(root);
            IEnumerable <Dictionary> dictionaries =
                dictionaryEntries
                .Select(x => x.DictionaryCode)
                .Distinct()
                .Select(DictionaryRepository.Get)
                .OrderBy(x => x.Name);

            var viewModel = new ViewModel(
                arabicRoot: root,
                rootLetterNames: rootLetterNames,
                dictionaries: dictionaries,
                types: wordTypesViewModel);

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