public IList <DictionaryType> GetList(DictionaryTypeListParam param) { Expression <Func <DictionaryType, bool> > filter = p => true; filter = filter.AndIf(p => p.ParentId == param.ParentId, !string.IsNullOrWhiteSpace(param.ParentId)) .AndIf(p => p.IsEnable == param.IsEnable, true) .AndIf(p => p.IsDelete == param.IsDelete, true) .AndIf(p => p.IsParent == param.IsDelete, true); Func <IQueryable <DictionaryType>, IOrderedQueryable <DictionaryType> > orderBy = o => o.OrderByDescending(p => p.CreatedOn); return(_dictionaryTypeRepository.GetList(filter)); }
/// <summary> /// 获取字典类型 /// </summary> /// <param name="dictionaryTypeParentId">父节点ID</param> /// <param name="dictionaryTypeId">字典类型ID</param> /// <returns></returns> public List <SelectListItem> GetSelectList(string dictionaryTypeParentId, string dictionaryTypeId) { var param = new DictionaryTypeListParam() { ParentId = dictionaryTypeParentId }; var selectListItems = new List <SelectListItem>(); this.GetList(param).ToList() .ForEach(p => selectListItems.Add(new SelectListItem() { Text = p.Name, Value = p.DicTypeId, Selected = p.DicTypeId == dictionaryTypeId })); return(selectListItems); }