Пример #1
0
        public IActionResult Test()
        {
            string language = HttpContext.Session.GetString("lang");
            var    lang_id  = from s in db.Languages where s.Name.ToString() == language select s.Id;

            int[] lgid = lang_id.ToArray();

            string native_lang    = HttpContext.Session.GetString("native_lang");
            var    native_lang_id = from s in db.Languages where s.Name.ToString() == native_lang select s.Id;

            int[] ntv_lgid = native_lang_id.ToArray();

            TestsDTOsRepository TestDTOs = new TestsDTOsRepository();

            List <CategoriesDTO> DTO = TestDTOs.GetTestDTOs(ntv_lgid[0], lgid[0]);

            return(View(DTO));
        }
Пример #2
0
        public JsonResult TestStatictics()
        {
            string language = HttpContext.Session.GetString("lang");
            var    lang_id  = from s in db.Languages where s.Name.ToString() == language select s.Id;

            int[] lgid = lang_id.ToArray();

            string native_lang    = HttpContext.Session.GetString("native_lang");
            var    native_lang_id = from s in db.Languages where s.Name.ToString() == native_lang select s.Id;

            int[] ntv_lgid = native_lang_id.ToArray();

            CategoriesDTOsRepository categoryDTOs = new CategoriesDTOsRepository();
            List <CategoriesDTO>     CatDTO       = categoryDTOs.GetCategoriesDTOs(ntv_lgid[0], lgid[0]).ToList();

            TestsDTOsRepository  TestDTOs = new TestsDTOsRepository();
            List <CategoriesDTO> TestDTO  = TestDTOs.GetTestDTOs(ntv_lgid[0], lgid[0]).ToList();

            LanguagesDTOsRepository LangDTOs = new LanguagesDTOsRepository();
            List <CategoriesDTO>    LangDTO  = LangDTOs.GetLanguagesDTOs(ntv_lgid[0], lgid[0]).ToList();

            TestResultsRepository testResultRepository = new TestResultsRepository();
            List <TestResults>    testResult           = testResultRepository.GetList().ToList();

            TotalScoresRepository totalRepository = new TotalScoresRepository();
            List <TotalScores>    totalScore      = totalRepository.GetList().ToList();


            StatisticObject statisticObject = new StatisticObject();

            statisticObject.CategoriesDTO = CatDTO;
            statisticObject.LanguageDTO   = LangDTO;
            statisticObject.TestsDTO      = TestDTO;
            statisticObject.TestResults   = testResult;
            statisticObject.TotalScore    = totalScore;



            return(Json(statisticObject));
        }