public async Task <IActionResult> GetAsync( Guid examCategoryId, [FromQuery] int?p = 1, [FromQuery] string filter = "") { if (examCategoryId == Guid.Empty) { return(PartialView(AppTheme.ContentNothing)); } var examCat = await _ExamCategoryService.GetSimpify(examCategoryId); if (examCat.Success) { ViewBag.CurrentExamCategory = examCat.Data; } else { return(PartialView(AppTheme.ContentNothing)); } if (p == null || p <= 0) { p = 1; } ViewBag.p = p.Value; var serchInp = new GetExamCatInstructDTO { ExamCategoryId = examCategoryId, FilterDisplayName = filter ?? "", MaxResultCount = AppTheme.Limit, SkipCount = (p.Value - 1) * AppTheme.Limit, }; var res = await _ExamCatInstructService.GetListAsync(serchInp); if (res.Success) { PagedResultDto <ExamCatInstructDTO> Containers = res.Data; string listRes = string.Format("Showing {0} to {1} of {2} entries", res.Data.TotalCount > 0 ? serchInp.SkipCount + 1 : 0, serchInp.SkipCount + res.Data.Items.Count, res.Data.TotalCount); if (!filter.IsNullOrEmpty()) { listRes += string.Format(" for \"{0}\"", serchInp.FilterDisplayName); } ViewBag.ListState = listRes; ViewBag.Filter = filter; ViewBag.Pagination = PaginateHelper.Generate( "javascript:syncData('" + examCategoryId + "','{0}', '" + filter + "');", p.Value, Containers.TotalCount, AppTheme.Limit); return(PartialView(TableView, Containers)); } else { return(PartialView(AppTheme.ContentNothing)); } }
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")); } } }
public async Task <IActionResult> OnGetAsync( Guid?exId, Guid?skillCatId, Guid?skillPartId) { 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 if (skillPartId == null || skillPartId == Guid.Empty) { ToastError(L["Please select correct skill part"]); return(Redirect($"/manager/exam-categories/{exId}/skill-categories/{skillCatId}/skill-parts")); } else { // Lấy exam category var examCat = await _ExamCategoryService.GetSimpify(exId.Value); if (examCat.Success) { CurrentExamCategory = examCat.Data; // Lấy skill category var skCat = _SkillCategoryService.GetSimpify(skillCatId.Value); if (skCat.Success) { CurrentSkillCategory = skCat.Data; // Lấy skill part var skPart = _SkillPartService.GetSimpify(skillPartId.Value); if (skPart.Success) { CurrentSkillPart = skPart.Data; return(Page()); } else { ToastError(skPart.Message); } } else { ToastError(skCat.Message); } return(Redirect($"/manager/exam-categories/{exId}/skill-categories")); } ToastError(examCat.Message); return(Redirect($"/manager/exam-categories")); } }
private async Task <string> PreLaunch(Guid?exCatId, Guid?id) { if (exCatId == null || exCatId == Guid.Empty) { ToastError(L["Please select correct Exam category"]); return($"/manager/exam-categories"); } var examCat = await _ExamCategoryService.GetSimpify(exCatId.Value); if (!examCat.Success) { ToastError(examCat.Message); return($"/manager/exam-categories"); } CurrentExamCategory = examCat.Data; return(null); }
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); }
// Run and validate, get nesscessary data private async Task <string> PreLaunch(Guid?exId, Guid?skillCatId, Guid?skillPartId, 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"); } if (skillPartId == null || skillPartId == Guid.Empty) { ToastError(L["Please select correct skill part"]); return($"/manager/exam-categories/{exId}/skill-categories/{skillCatId}/skill-parts"); } // 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; // Lấy phần của mục kỹ năng var skPart = _SkillPartService.GetSimpify(skillPartId.Value); if (!skPart.Success) { ToastError(skPart.Message); return($"/manager/exam-categories/{exId}/skill-categories/{skillCatId}/skill-parts"); } CurrentSkillPart = skPart.Data; if (CurrentSkillPart.MasterContentType == Common.MasterContentTypes.Grammar) { var res = await _GrammarService.GetAllSimpifyAsync(); if (!res.Success || res.Data == null) { ToastError(res.Message); return(""); } Grammars = res.Data; } return(null); }