Esempio n. 1
0
        public async Task <IActionResult> OnGetAsync(Guid?exId, Guid?skillCatId)
        {
            if (exId == null || exId == Guid.Empty)
            {
                ToastError(L["Please select correct exam category"]);
                return(Redirect($"/manager/exam-categories"));
            }
            else if (skillCatId == null || skillCatId == Guid.Empty)
            {
                ToastError(L["Please select correct skill category"]);
                return(Redirect($"/manager/exam-categories/{exId}/skill-categories"));
            }
            else
            {
                var examCat = await _ExamCategoryService.GetSimpify(exId.Value);

                if (examCat.Success)
                {
                    CurrentExamCategory = examCat.Data;
                    var skCat = _SkillCategoryService.GetSimpify(skillCatId.Value);
                    if (skCat.Success)
                    {
                        CurrentSkillCategory = skCat.Data;
                        var res = _SkillPartService.GetBase(skillCatId.Value);
                        if (res.Success)
                        {
                            SkillParts = res.Data;
                            return(Page());
                        }
                        else
                        {
                            ToastError(res.Message);
                        }
                    }
                    else
                    {
                        ToastError(skCat.Message);
                    }
                    return(Redirect($"/manager/exam-categories/{exId}/skill-categories"));
                }
                ToastError(examCat.Message);
                return(Redirect($"/manager/exam-categories"));
            }
        }
        public async Task <string> PreLaunch(Guid?exId, Guid?skillCatId, Guid?id)
        {
            if (exId == null || exId == Guid.Empty)
            {
                ToastError(L["Please select correct exam category"]);
                return($"/manager/exam-categories");
            }

            if (skillCatId == null || skillCatId == Guid.Empty)
            {
                ToastError(L["Please select correct skill category"]);
                return($"/manager/exam-categories/{exId}/skill-categories");
            }

            // Lấy loại kỳ thi
            var examCat = await _ExamCategoryService.GetSimpify(exId.Value);

            if (!examCat.Success)
            {
                ToastError(examCat.Message);
                return($"/manager/exam-categories");
            }
            CurrentExamCategory = examCat.Data;

            // Lấy mục kỹ năng
            var skCat = _SkillCategoryService.GetSimpify(skillCatId.Value);

            if (!skCat.Success)
            {
                ToastError(skCat.Message);
                return($"/manager/exam-categories/{exId}/skill-categories");
            }
            CurrentSkillCategory = skCat.Data;

            return(null);
        }