/// <summary> /// 根据课程类别搜索输入分页获取课程类别列表 /// </summary> /// <param name="input">课程类别搜索输入</param> /// <returns>课程类别列表</returns> public async Task <Tuple <List <CourseCategoryViewDto>, int> > GetCourseCategoryPageList(CourseCategorySearchInput input) { var newInput = new DictionarySearchInput { Name = input.CategoryName, PageIndex = input.PageIndex, PageSize = input.PageSize, ParentValue = CommConstant.PatientEduParentValue }; var result = await _systemRepository.GetDictionaryPageList(newInput); var tuple = new Tuple <List <CourseCategoryViewDto>, int>(Mapper.Map <List <Dictionary>, List <CourseCategoryViewDto> >(result.Item1), result.Item2); return(tuple); }
/// <summary> /// 根据字典搜索输入分页获取字典实体列表 /// </summary> /// <param name="input">字典搜索输入</param> /// <returns>字典实体列表</returns> public async Task <Tuple <List <Dictionary>, int> > GetDictionaryPageList(DictionarySearchInput input) { var query = _context.Dictionary.AsQueryable(); if (!string.IsNullOrEmpty(input.Name)) { query = query.Where(i => i.Name.Contains(input.Name)); } if (input.ParentValue != -1) { query = query.Where(i => i.ParentValue == input.ParentValue); } int total = query.Count(); var dictionaryList = await query.OrderBy(i => i.SortId).Skip(input.PageSize * (input.PageIndex - 1)).Take(input.PageSize).ToListAsync(); return(new Tuple <List <Dictionary>, int>(dictionaryList, total)); }