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 <bool> SyncUserInstructors() { if (ExamCategoryId == null || ExamCategoryId.Value == Guid.Empty) { ToastError(L["Exam category is invalid"]); return(false); } if (CurrentPage <= 0) { CurrentPage = 1; } var searchInp = new GetExamCatInstructDTO { //UserId = null, // Không có phần này để có thể lấy tất cả giáo viên hướng dẫn ExamCategoryId = ExamCategoryId, FilterDisplayName = Filter, MaxResultCount = AppTheme.Limit, SkipCount = (CurrentPage - 1) * AppTheme.Limit, }; var res = await _ExamCatInstructService.GetListAsync(searchInp); if (res.Success) { Instructors = res.Data; ListState = string.Format("Showing {0} to {1} of {2} entries", res.Data.TotalCount > 0 ? searchInp.SkipCount + 1 : 0, searchInp.SkipCount + res.Data.Items.Count, res.Data.TotalCount); if (!Filter.IsNullOrEmpty()) { ListState += string.Format(" for \"{0}\"", searchInp.FilterDisplayName); } Pagination = PaginateHelper.Generate( "javascript:movePage({0});", CurrentPage, Instructors.TotalCount, AppTheme.Limit); return(true); } else { ToastError(res.Message); return(false); } }