コード例 #1
0
        public async Task <IActionResult> Detail(HelperTipsTypes type,
                                                 [FromQuery] Guid id,
                                                 [FromQuery] bool testable = false)
        {
            var modalTitle    = "";
            var modalContent  = "";
            var examStartPath = "";

            if (type == HelperTipsTypes.Exam)
            {
                var exam = (await _ExamCategoryServices.GetAsync(id)).Data;
                modalTitle   = String.Format(L["{0} tips"], exam.Name);
                modalContent = exam.Tips;
            }
            else if (type == HelperTipsTypes.SkillCategory)
            {
                var sCat = (await _SkillCategoryServices.GetAsync(id)).Data;
                var exam = (await _ExamCategoryServices.GetAsync(sCat.ExamCategoryId)).Data;
                modalTitle   = String.Format(L["{0}:{1} tips"], exam.Name, sCat.Name);
                modalContent = sCat.Tips;
            }
            else if (type == HelperTipsTypes.SkillPart)
            {
                var sPart = (await _SkillPartServices.GetAsync(id)).Data;
                var sCat  = (await _SkillCategoryServices.GetAsync(sPart.ExamSkillCategoryId)).Data;
                var exam  = (await _ExamCategoryServices.GetAsync(sCat.ExamCategoryId)).Data;

                modalTitle   = String.Format(L["{0}:{1} {2} tips"], exam.Name, sCat.Name, sPart.Name);
                modalContent = sPart.Tips;
            }
            ViewBag.ModalTitle    = modalTitle;
            ViewBag.ModalContent  = modalContent;
            ViewBag.ExamStartPath = examStartPath;
            return(PartialView("~/Pages/_Common/Partials/Tips.cshtml"));
        }
コード例 #2
0
        public async Task <IActionResult> Detail(HelperTipsTypes type,
                                                 Guid id,
                                                 [FromQuery(Name = "ex")] string ex,
                                                 [FromQuery(Name = "sc")] string sc,
                                                 [FromQuery(Name = "instructor")] Guid?instructor)
        {
            // Mã của dối tượng hiện tại
            ViewBag.Id = id;
            // Cho biết có hiển thị nút cập nhật dữ liệu hay không
            ViewBag.ShowManagerButton = type == HelperTipsTypes.SkillPart;

            var renderType = -1;

            if (type == HelperTipsTypes.Exam)
            {
                var exam = (await _ExamCategoryServices.GetAsync(id)).Data;
                ViewBag.ModalName    = $"{exam.Name} Exam's tips";
                ViewBag.ModalContent = exam.Tips;
                renderType           = (int)RenderExamTypes.Synthetic;
            }
            else if (type == HelperTipsTypes.SkillCategory)
            {
                var sCat = (await _SkillCategoryServices.GetAsync(id)).Data;
                var skPs = _SkillPartServices.GetBase(sCat.Id).Data;
                if (skPs.Count <= 1)
                {
                    ViewBag.ShowManagerButton = true;
                    ViewBag.Id = skPs.FirstOrDefault()?.Id ?? Guid.Empty;
                }
                ViewBag.ModalName    = $"{sCat.Name} of {ex} Exam's tips";
                ViewBag.ModalContent = sCat.Tips;
                renderType           = (int)RenderExamTypes.SkillCategory;
            }
            else if (type == HelperTipsTypes.SkillPart)
            {
                var sPart = (await _SkillPartServices.GetAsync(id)).Data;
                ViewBag.ModalName    = $"{sc} {sPart.Name} of {ex} Exam's tips";
                ViewBag.ModalContent = sPart.Tips;
                renderType           = (int)RenderExamTypes.SkillPart;
            }
            ViewBag.StartExamUrl = $"/exams/{renderType}/exam/{id}?instructor={instructor}";
            return(PartialView("~/Pages/Exams/Partials/Detail.cshtml"));
        }