public async Task <List <Ex> > GetDataCollection()
        {
            // Lấy danh sách kỳ thi
            (await _ExamCategoryServices.GetBase()).Data
            .ForEach(x =>
            {
                var ex = new Ex
                {
                    Exam = x,
                    Scs  = new List <Sc>()
                };

                _SkillCategoryServices.GetBase(x.Id).Data
                .ForEach(y =>
                {
                    var sc = new Sc
                    {
                        Cat   = y,
                        Parts = _SkillPartServices.GetBase(y.Id).Data
                    };
                    ex.Scs.Add(sc);
                });

                Exams.Add(ex);
            });

            return(Exams);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnGetAsync(Guid?exCatId)
        {
            if (exCatId == null || exCatId == Guid.Empty)
            {
                ToastError(L["Please select correct Exam category"]);
                return(Redirect($"/manager/exam-categories"));
            }
            else
            {
                var examCat = await _ExamCategoryService.GetSimpify(exCatId.Value);

                if (examCat.Success)
                {
                    CurrentExamCategory = examCat.Data;
                    var res = _SkillCategoryService.GetBase(exCatId.Value);
                    if (res.Success)
                    {
                        SkillCategories = res.Data;
                    }
                    else
                    {
                        ToastError(res.Message);
                    }
                    return(Page());
                }
                else
                {
                    ToastError(examCat.Message);
                    return(Redirect($"/manager/exam-categories"));
                }
            }
        }